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

22 lines
685 B
TypeScript

import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { AuthorName } from './author-name';
import { WorkAuthor } from './work-author';
@Entity()
export class Author implements AuthorEntityInterface {
@PrimaryGeneratedColumn()
public readonly id!: number;
@Column({
nullable: false,
default: '',
})
public nameCanonical!: string;
@OneToMany(() => AuthorName, (authorName: AuthorNameEntityInterface) => authorName.entity)
public names!: Promise<AuthorNameEntityInterface[]>;
@OneToMany(() => WorkAuthor, (workAuthor: WorkAuthorEntityInterface) => workAuthor.author)
public workAuthors!: Promise<WorkAuthorEntityInterface[]>;
}