chore: add ticket module and tickets entity
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
|
||||
|
||||
import { Role } from "./role.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { Ticket } from "../../tickets/entities/ticket.entity";
|
||||
|
||||
@Entity()
|
||||
export class User extends BaseEntity {
|
||||
@@ -11,7 +12,7 @@ export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 11, unique: true, nullable: false })
|
||||
phone: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150, unique: true, nullable: true })
|
||||
@Column({ type: "varchar", length: 50, unique: true, nullable: true })
|
||||
userName: string;
|
||||
|
||||
@Column({ type: "varchar", length: 150 })
|
||||
@@ -23,13 +24,16 @@ export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 200 })
|
||||
lastName: string;
|
||||
|
||||
@Column()
|
||||
@Column({ type: "varchar", length: 12, nullable: true })
|
||||
birthDate: string;
|
||||
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
@Column({ type: "varchar", length: 100, unique: true, nullable: false })
|
||||
nationalCode: string;
|
||||
|
||||
@JoinColumn()
|
||||
@OneToOne(() => Role, { eager: true, cascade: true, onDelete: "RESTRICT", nullable: false })
|
||||
@ManyToOne(() => Role, { eager: true, onDelete: "RESTRICT", nullable: false })
|
||||
role: Role;
|
||||
|
||||
@OneToMany(() => Ticket, (ticket) => ticket.user)
|
||||
tickets: Ticket[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user