22 lines
747 B
TypeScript
22 lines
747 B
TypeScript
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { CollectionName } from './collection-name';
|
|
import { CollectionPart } from './collection-part';
|
|
|
|
@Entity()
|
|
export class Collection implements CollectionEntityInterface {
|
|
@PrimaryGeneratedColumn()
|
|
public readonly id!: number;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
default: '',
|
|
})
|
|
public nameCanonical!: string;
|
|
|
|
@OneToMany(() => CollectionName, (collectionName: CollectionNameEntityInterface) => collectionName.entity)
|
|
public names!: Promise<CollectionNameEntityInterface[]>;
|
|
|
|
@OneToMany(() => CollectionPart, (collectionPart: CollectionPartEntityInterface) => collectionPart.collection)
|
|
public parts!: Promise<CollectionPartEntityInterface[]>;
|
|
}
|