28 lines
749 B
TypeScript
28 lines
749 B
TypeScript
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { SiteName } from './site-name';
|
|
import { Source } from './source';
|
|
|
|
/**
|
|
* This non-user-maintained entity describes an online provider of works which can be scraped.
|
|
*/
|
|
@Entity()
|
|
export class Site implements IdentifiableEntityInterface, MultiNamedEntityInterface {
|
|
@PrimaryGeneratedColumn()
|
|
public id!: number;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
default: '',
|
|
})
|
|
public nameCanonical!: string;
|
|
|
|
@OneToMany(() => SiteName, (siteName: SiteName) => siteName.entity)
|
|
public names!: Promise<SiteName[]>;
|
|
|
|
/**
|
|
* sources belonging to this site
|
|
*/
|
|
@OneToMany(() => Source, (source: Source) => source.site)
|
|
public sources!: Promise<Source[]>;
|
|
}
|