28 lines
585 B
TypeScript
28 lines
585 B
TypeScript
import { Column, Entity, ManyToMany, ManyToOne } from 'typeorm';
|
|
import { Base } from './bases/base';
|
|
import { Copy } from './copy';
|
|
import { Site } from './site';
|
|
|
|
@Entity()
|
|
export class Source extends Base {
|
|
@Column({
|
|
nullable: false,
|
|
unique: true,
|
|
})
|
|
public uri: string;
|
|
|
|
@ManyToOne(() => Site, site => site.sources, {
|
|
nullable: false,
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
public site: Promise<Site>;
|
|
|
|
@ManyToMany(() => Copy, {
|
|
nullable: false,
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
public copies: Promise<Copy[]>;
|
|
}
|