import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { PercentCheck } from '../decorators/percent-check'; import { Tag } from './tag'; import { Work } from './work'; @Entity() @PercentCheck('weight') export class WorkTag implements WorkTagEntityInterface { @PrimaryGeneratedColumn() public readonly id!: number; @ManyToOne(() => Tag, (tag: TagEntityInterface) => tag.workTags, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public tag!: Promise; @ManyToOne(() => Work, (work: WorkEntityInterface) => work.workTags, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public work!: Promise; @Column('int', { nullable: true, }) public weight!: number | null; }