36 lines
911 B
TypeScript
36 lines
911 B
TypeScript
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
|
|
|
|
import { Role } from "./role.entity";
|
|
import { BaseEntity } from "../../../common/entities/base.entity";
|
|
|
|
@Entity()
|
|
export class User extends BaseEntity {
|
|
@Column({ type: "varchar", length: 150, nullable: true })
|
|
email: string;
|
|
|
|
@Column({ type: "varchar", length: 11, unique: true, nullable: false })
|
|
phone: string;
|
|
|
|
@Column({ type: "varchar", length: 150, unique: true, nullable: true })
|
|
userName: string;
|
|
|
|
@Column({ type: "varchar", length: 150 })
|
|
password: string;
|
|
|
|
@Column({ type: "varchar", length: 150 })
|
|
firstName: string;
|
|
|
|
@Column({ type: "varchar", length: 200 })
|
|
lastName: string;
|
|
|
|
@Column()
|
|
birthDate: string;
|
|
|
|
@Column({ type: "varchar", length: 100 })
|
|
nationalCode: string;
|
|
|
|
@JoinColumn()
|
|
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "RESTRICT", nullable: false })
|
|
role: Role;
|
|
}
|