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