-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateus Garcia
committed
Mar 20, 2023
1 parent
02b0479
commit 4697da2
Showing
5 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { | ||
PrimaryGeneratedColumn, | ||
Column, | ||
Entity, | ||
JoinColumn, | ||
ManyToOne, | ||
UpdateDateColumn, | ||
} from 'typeorm'; | ||
import { IsEmpty, IsNotEmpty } from 'class-validator'; | ||
|
||
import { Users, IUsers } from '.'; | ||
|
||
@Entity('notes') | ||
export class Notes { | ||
@PrimaryGeneratedColumn() | ||
public id: number; | ||
|
||
@IsNotEmpty() | ||
@Column({ | ||
type: 'text', | ||
nullable: false, | ||
}) | ||
public text: string; | ||
|
||
@IsEmpty() | ||
@Column({ | ||
name: 'created_at', | ||
type: 'timestamp', | ||
nullable: true, | ||
default: 'CURRENT_TIMESTAMP', | ||
}) | ||
public createdAt: Date; | ||
|
||
@IsEmpty() | ||
@UpdateDateColumn({ | ||
name: 'updated_at', | ||
type: 'timestamp', | ||
nullable: true, | ||
default: 'CURRENT_TIMESTAMP', | ||
}) | ||
public updatedAt: Date; | ||
|
||
@ManyToOne(() => Users, (item) => item.notes) | ||
@IsNotEmpty() | ||
@JoinColumn({ | ||
name: 'created_by', | ||
}) | ||
public createdBy: IUsers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters