rename ticket to chat

This commit is contained in:
2026-02-23 11:01:21 +03:30
parent 8303a4c108
commit cc9f52652d
14 changed files with 162 additions and 179 deletions
+40
View File
@@ -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;
}