import { Column, Entity, ManyToMany, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Copy } from './copy'; import { Site } from './site'; /** * This entity describes an external source of a copy, in most cases that is a website. */ @Entity() export class Source implements IIdentifiableEntity { @PrimaryGeneratedColumn() public id: number; /** * the uri to the sauce */ @Column({ nullable: false, }) public uri: string; /** * the site connected to the source */ @ManyToOne(() => Site, (site: Site) => site.sources, { nullable: true, onDelete: 'RESTRICT', onUpdate: 'CASCADE', }) public site: Promise; /** * the copies which can be found here */ @ManyToMany(() => Copy, (copy: Copy) => copy.sources) public copies: Promise; }