2020-04-10 04:04:13 +02:00
|
|
|
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
2020-04-10 05:02:19 +02:00
|
|
|
import { Author } from './author';
|
2020-04-10 04:04:13 +02:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class AuthorName implements IIdentifiableEntity, INameEntity {
|
|
|
|
@PrimaryGeneratedColumn()
|
2020-07-25 02:02:37 +02:00
|
|
|
public id!: number;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
2020-04-10 05:12:14 +02:00
|
|
|
@ManyToOne(() => Author, (author: Author) => author.names, {
|
|
|
|
nullable: false,
|
|
|
|
onDelete: 'CASCADE',
|
|
|
|
onUpdate: 'CASCADE',
|
|
|
|
})
|
2020-07-25 02:02:37 +02:00
|
|
|
public entity!: Promise<Author>;
|
2020-04-10 04:04:13 +02:00
|
|
|
|
|
|
|
@Column({
|
|
|
|
nullable: false,
|
|
|
|
})
|
2020-07-25 02:02:37 +02:00
|
|
|
public name!: string;
|
2020-04-10 04:04:13 +02:00
|
|
|
}
|