45 lines
974 B
TypeScript
Executable File
45 lines
974 B
TypeScript
Executable File
import {
|
|
Entity,
|
|
Index,
|
|
ManyToOne,
|
|
OneToMany,
|
|
Property,
|
|
Collection,
|
|
Cascade,
|
|
Enum,
|
|
PrimaryKey,
|
|
} from '@mikro-orm/core';
|
|
|
|
import { BaseEntity } from "../../../common/entities/base.entity";
|
|
import { User } from "../../user/entities/user.entity";
|
|
import { TicketStatus } from "../enums/ticket-status.enum";
|
|
// import { Product } from 'src/modules/product/entities/product.entity';
|
|
import { Admin } from 'src/modules/admin/entities/admin.entity';
|
|
|
|
@Entity()
|
|
export class Ticket extends BaseEntity {
|
|
@PrimaryKey({ type: "bigint", autoincrement: true })
|
|
id: bigint;
|
|
|
|
@Enum(() => TicketStatus)
|
|
status: TicketStatus;
|
|
|
|
@Property({ type: 'text' })
|
|
content: string;
|
|
|
|
@ManyToOne(() => Admin)
|
|
admin: Admin | null;
|
|
|
|
@ManyToOne(() => User,)
|
|
user: User;
|
|
|
|
@ManyToOne(() => Ticket)
|
|
parent: Ticket | null;
|
|
|
|
@OneToMany(()=>Ticket,(ticket)=>ticket.id)
|
|
children=new Collection<Ticket>(this)
|
|
|
|
@Property({ type: 'json' })
|
|
attachments: string[]
|
|
}
|