import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { TransformationType } from './transformation-type'; import { Work } from './work'; @Entity() export class Transformation implements TransformationEntityInterface { @PrimaryGeneratedColumn() public readonly id!: number; @ManyToOne(() => Work, (work: Work) => work.transformationOf, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public byWork!: Promise; @ManyToOne( () => TransformationType, (transformationType: TransformationTypeEntityInterface) => transformationType.transformations, { nullable: false, onDelete: 'RESTRICT', onUpdate: 'CASCADE', } ) public type!: Promise; @ManyToOne(() => Work, (work: WorkEntityInterface) => work.transformedBy, { nullable: true, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public ofWork!: Promise | null; @Column({ nullable: false, default: 0, }) public order!: number; }