RenaiApp/src/main/entities/library/source.ts

26 lines
681 B
TypeScript
Raw Normal View History

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<SiteEntityInterface> | null;
@ManyToMany(() => Copy, (copy: CopyEntityInterface) => copy.sources)
public copies!: Promise<CopyEntityInterface[]>;
}