2020-04-10 05:02:19 +02:00
|
|
|
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
2020-04-10 04:04:13 +02:00
|
|
|
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;
|
|
|
|
|
2020-04-10 05:12:14 +02:00
|
|
|
@OneToMany(() => AuthorRoleName, (authorRoleName: AuthorRoleName) => authorRoleName.entity)
|
2020-04-10 04:04:13 +02:00
|
|
|
public names: Promise<AuthorRoleName[]>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* relation to the entity connecting with the author and work
|
|
|
|
*/
|
2020-04-10 05:12:14 +02:00
|
|
|
@ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.authorRoles)
|
2020-04-10 04:04:13 +02:00
|
|
|
public workAuthors: Promise<WorkAuthor[]>;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
public description: string;
|
|
|
|
}
|