Created
January 15, 2021 16:53
-
-
Save cartorjo/adb11b3c446e94b708a814da47253564 to your computer and use it in GitHub Desktop.
TypeORM
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
import {Column, PrimaryGeneratedColumn, Entity} from "typeorm"; | |
import {MinLength, IsEmail, IsDate} from "class-validator"; | |
@Entity() | |
export class User { | |
@PrimaryGeneratedColumn() | |
id: number; | |
@Column() | |
@Generated("uuid") | |
uuid: string; | |
@Column({nullable: false}) | |
@MinLength(2) | |
name: string; | |
@Column({nullable: false}) | |
@MinLength(2) | |
last_name: string; | |
@Column() | |
@IsDate() | |
birthday: Date; | |
@Column() | |
nationality: string; | |
@Column() | |
phone_number: string; | |
@Column() | |
mobile_number: string; | |
@Column() | |
@IsEmail() | |
email: string; | |
@Column() | |
url: string; | |
@Column() | |
notes: string | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment