chore: add user entity and role entity
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { Column, Entity, OneToOne } from "typeorm";
|
||||
|
||||
import { Role } from "./role.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150, unique: true })
|
||||
export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 150, unique: true, nullable: true })
|
||||
email: string;
|
||||
|
||||
@Column({ type: "varchar", length: 11, unique: true })
|
||||
@Column({ type: "varchar", length: 11, unique: true, nullable: true })
|
||||
phoneNumber: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150 })
|
||||
@@ -25,4 +25,7 @@ export class User {
|
||||
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
nationalCode: string;
|
||||
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "SET NULL" })
|
||||
role: Role;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user