rename ticket to chat
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
Entity,
|
||||
ManyToOne,
|
||||
Property,
|
||||
OptionalProps,
|
||||
} from '@mikro-orm/core';
|
||||
import { User } from "../../user/entities/user.entity";
|
||||
import { Admin } from 'src/modules/admin/entities/admin.entity';
|
||||
import { AttachmentType } from '../interfaces/chat';
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
|
||||
@Entity()
|
||||
export class Chat extends BaseEntity {
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||
|
||||
|
||||
@Property({ type: 'text' })
|
||||
content: string;
|
||||
|
||||
@ManyToOne(() => User, { nullable: true })
|
||||
user?: User | null;
|
||||
|
||||
@ManyToOne(() => Admin, { nullable: true })
|
||||
admin?: Admin | null;
|
||||
|
||||
@Property({ type: 'json', nullable: true })
|
||||
attachments?: AttachmentType[]
|
||||
|
||||
@Property({ type: 'string' })
|
||||
refId!: string
|
||||
|
||||
@ManyToOne(() => Chat, { nullable: true })
|
||||
parent?: Chat
|
||||
|
||||
@Property({ defaultRaw: 'now()', columnType: 'timestamptz' })
|
||||
createdAt: Date = new Date();
|
||||
|
||||
@Property({ nullable: true, columnType: 'timestamptz' })
|
||||
readAt?: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user