chore: add ticket module and tickets entity

This commit is contained in:
mahyargdz
2025-01-22 17:03:46 +03:30
parent c48ec70638
commit e3762c1eba
16 changed files with 166 additions and 27 deletions
+9 -5
View File
@@ -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[];
}