RenaiApp/src/main/entities/library/author-role.ts

28 lines
827 B
TypeScript

import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { AuthorRoleName } from './author-role-name';
import { WorkAuthor } from './work-author';
@Entity()
export class AuthorRole implements AuthorRoleEntityInterface {
@PrimaryGeneratedColumn()
public readonly id!: number;
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@OneToMany(() => AuthorRoleName, (authorRoleName: AuthorRoleNameEntityInterface) => authorRoleName.entity)
public names!: Promise<AuthorRoleNameEntityInterface[]>;
@ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthorEntityInterface) => workAuthor.authorRoles)
public workAuthors!: Promise<WorkAuthorEntityInterface[]>;
@Column({
nullable: false,
default: '',
})
public description!: string;
}