2020-04-10 05:02:19 +02:00
|
|
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
2020-04-10 04:04:13 +02:00
|
|
|
import { CollectionName } from './collection-name';
|
|
|
|
import { CollectionPart } from './collection-part';
|
|
|
|
|
|
|
|
@Entity()
|
2021-01-24 19:11:45 +01:00
|
|
|
export class Collection implements CollectionEntityInterface {
|
2020-04-10 04:04:13 +02:00
|
|
|
@PrimaryGeneratedColumn()
|
2021-01-24 19:11:45 +01:00
|
|
|
public readonly id!: number;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2020-08-18 00:29:49 +02:00
|
|
|
@Column({
|
|
|
|
nullable: false,
|
|
|
|
default: '',
|
|
|
|
})
|
2020-07-25 02:02:37 +02:00
|
|
|
public nameCanonical!: string;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2021-01-24 19:11:45 +01:00
|
|
|
@OneToMany(() => CollectionName, (collectionName: CollectionNameEntityInterface) => collectionName.entity)
|
|
|
|
public names!: Promise<CollectionNameEntityInterface[]>;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2021-01-24 19:11:45 +01:00
|
|
|
@OneToMany(() => CollectionPart, (collectionPart: CollectionPartEntityInterface) => collectionPart.collection)
|
|
|
|
public parts!: Promise<CollectionPartEntityInterface[]>;
|
2020-04-10 04:04:13 +02:00
|
|
|
}
|