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';
|
|
|
|
|
|
|
|
@Entity()
|
2021-01-24 19:11:45 +01:00
|
|
|
export class AuthorRole implements AuthorRoleEntityInterface {
|
2020-04-10 04:04:13 +02:00
|
|
|
@PrimaryGeneratedColumn()
|
2021-01-24 19:11:45 +01:00
|
|
|
public readonly id!: number;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
|
|
|
@Column({
|
|
|
|
nullable: false,
|
2020-08-18 00:29:49 +02:00
|
|
|
default: '',
|
2020-04-10 04:04:13 +02:00
|
|
|
})
|
2020-07-25 02:02:37 +02:00
|
|
|
public nameCanonical!: string;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2021-01-24 19:11:45 +01:00
|
|
|
@OneToMany(() => AuthorRoleName, (authorRoleName: AuthorRoleNameEntityInterface) => authorRoleName.entity)
|
|
|
|
public names!: Promise<AuthorRoleNameEntityInterface[]>;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2021-01-24 19:11:45 +01:00
|
|
|
@ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthorEntityInterface) => workAuthor.authorRoles)
|
|
|
|
public workAuthors!: Promise<WorkAuthorEntityInterface[]>;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2020-08-18 00:29:49 +02:00
|
|
|
@Column({
|
|
|
|
nullable: false,
|
|
|
|
default: '',
|
|
|
|
})
|
2020-07-25 02:02:37 +02:00
|
|
|
public description!: string;
|
2020-04-10 04:04:13 +02:00
|
|
|
}
|