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