22 lines
549 B
TypeScript
22 lines
549 B
TypeScript
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
import { AuthorRole } from './author-role';
|
|
|
|
@Entity()
|
|
export class AuthorRoleName implements IdentifiableEntityInterface, NameEntityInterface {
|
|
@PrimaryGeneratedColumn()
|
|
public id!: number;
|
|
|
|
@ManyToOne(() => AuthorRole, (authorRole: AuthorRole) => authorRole.names, {
|
|
nullable: false,
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
public entity!: Promise<AuthorRole>;
|
|
|
|
@Column({
|
|
nullable: false,
|
|
default: '',
|
|
})
|
|
public name!: string;
|
|
}
|