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