Files
dsc-api/src/modules/task-manager/entities/attachment.entity.ts
T

33 lines
801 B
TypeScript

import {
Column,
Entity,
JoinColumn,
ManyToOne,
} from 'typeorm';
import { BaseEntity } from '../../../common/entities/base.entity';
import { TMTask } from './task.entity';
import { TMAttachmentType } from '../enums/attachment-type.enum';
@Entity('tm_attachments')
export class TMAttachment extends BaseEntity {
@Column({ type: 'varchar', length: 150 })
title: string;
@Column({ type: 'enum', enum: TMAttachmentType })
type: TMAttachmentType;
@Column({ type: 'text' })
file: string;
// --- Relations ---
@ManyToOne(() => TMTask, (task) => task.attachments, {
nullable: false,
onDelete: 'CASCADE',
})
@JoinColumn({ name: 'taskId' })
task: TMTask;
@Column({ type: 'uuid' })
taskId: string;
}