25 lines
504 B
TypeScript
25 lines
504 B
TypeScript
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { Author } from './author';
|
|
|
|
@Entity()
|
|
export class AuthorName implements IIdentifiableEntity, INameEntity {
|
|
@PrimaryGeneratedColumn()
|
|
public id: number;
|
|
|
|
@ManyToOne(
|
|
() => Author,
|
|
(author: Author) => author.names,
|
|
{
|
|
nullable: false,
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
}
|
|
)
|
|
public entity: Promise<Author>;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
})
|
|
public name: string;
|
|
}
|