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 IdentifiableEntityInterface, MultiNamedEntityInterface, DescribableEntityInterface { @PrimaryGeneratedColumn() public id!: number; @Column({ nullable: false, default: '', }) 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({ nullable: false, default: '', }) public description!: string; }