import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import { AuthorRoleName } from './author-role-name'; import { WorkAuthor } from './work-author'; /** * This entity describes the role an author has in a work. * Examples: story writing, drawing, animating, publishing, ... */ @Entity() export class AuthorRole implements IIdentifiableEntity, IMultiNamedEntity, IDescribableEntity { @PrimaryGeneratedColumn() public id: number; @Column({ nullable: false, }) public nameCanonical: string; @OneToMany(() => AuthorRoleName, (authorRoleName: AuthorRoleName) => authorRoleName.entity) public names: Promise; /** * relation to the entity connecting with the author and work */ @ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.authorRoles) public workAuthors: Promise; @Column() public description: string; }