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