import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Collection } from './collection'; import { Work } from './work'; @Entity() export class CollectionPart implements CollectionPartEntityInterface { @PrimaryGeneratedColumn() public readonly id!: number; @ManyToOne(() => Collection, (collection: CollectionEntityInterface) => collection.parts, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public collection!: Promise; @ManyToOne(() => Work, (work: WorkEntityInterface) => work.collectionParts, { nullable: false, onDelete: 'CASCADE', onUpdate: 'CASCADE', }) public work!: Promise; @Column({ nullable: false, default: 0, }) public order!: number; }