import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import { AuthorName } from './author-name'; import { WorkAuthor } from './work-author'; /** * This entity represents a single real-world entity, be it a person or named group of persons. */ @Entity() export class Author implements IIdentifiableEntity, IMultiNamedEntity { @PrimaryGeneratedColumn() public id: number; @Column({ nullable: false, }) public nameCanonical: string; @OneToMany( () => AuthorName, (authorName: AuthorName) => authorName.entity ) public names: Promise; /** * ultimately connects the author with a work and their role in that work */ @OneToMany( () => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.author ) public workAuthors: Promise; }