import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Copy } from './copy'; import { Site } from './site'; @Entity() export class Source implements SourceEntityInterface { @PrimaryGeneratedColumn() public readonly id!: number; @Column({ nullable: false, default: '', }) public uri!: string; @ManyToOne(() => Site, (site: SiteEntityInterface) => site.sources, { nullable: true, onDelete: 'RESTRICT', onUpdate: 'CASCADE', }) public site!: Promise | null; @ManyToMany(() => Copy, (copy: CopyEntityInterface) => copy.sources) public copies!: Promise; }