Files
ostan-complain-api/src/modules/reply/entities/reply-attachment.entity.ts
T

19 lines
608 B
TypeScript

import { BaseEntity } from "src/common/entities/base.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
import { Reply } from "./reply.entity";
import { Attachment } from "src/modules/attachment/entities/attachment.entity";
@Entity('reply_attachments')
export class ReplyAttachment extends BaseEntity {
@ManyToOne(() => Reply, (rp) => rp.attachments, {
onDelete: 'CASCADE'
})
reply: Reply;
@OneToOne(() => Attachment, (attch) => attch.reply, {
cascade: true,
onDelete: 'CASCADE'
})
@JoinColumn()
attachment: Attachment;
}