27 lines
804 B
TypeScript
27 lines
804 B
TypeScript
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<AuthorName[]>;
|
|
|
|
/**
|
|
* ultimately connects the author with a work and their role in that work
|
|
*/
|
|
@OneToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.author)
|
|
public workAuthors: Promise<WorkAuthor[]>;
|
|
}
|