30 lines
1007 B
TypeScript
30 lines
1007 B
TypeScript
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { CollectionName } from './collection-name';
|
|
import { CollectionPart } from './collection-part';
|
|
|
|
/**
|
|
* A collection is a set of works.
|
|
* For example, this can be a series or a set of alternate angles.
|
|
* What constitutes as a collection is ultimately up to the user.
|
|
*
|
|
* As a general rule of thumb:
|
|
* If authors of works see them as belonging together, they are a collection
|
|
*/
|
|
@Entity()
|
|
export class Collection implements IIdentifiableEntity, IMultiNamedEntity {
|
|
@PrimaryGeneratedColumn()
|
|
public id: number;
|
|
|
|
@Column()
|
|
public nameCanonical: string;
|
|
|
|
@OneToMany(() => CollectionName, (collectionName: CollectionName) => collectionName.entity)
|
|
public names: Promise<CollectionName[]>;
|
|
|
|
/**
|
|
* the connecting entity between this collection and the work
|
|
*/
|
|
@OneToMany(() => CollectionPart, (collectionPart: CollectionPart) => collectionPart.collection)
|
|
public parts: Promise<CollectionPart[]>;
|
|
}
|