Skip to content

Instantly share code, notes, and snippets.

@cartorjo
Created January 15, 2021 16:53
Show Gist options
  • Save cartorjo/adb11b3c446e94b708a814da47253564 to your computer and use it in GitHub Desktop.
Save cartorjo/adb11b3c446e94b708a814da47253564 to your computer and use it in GitHub Desktop.
TypeORM
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