metropolis/src/items/items.entity.ts

30 lines
401 B
TypeScript
Raw Normal View History

2021-07-08 23:58:07 +02:00
import {
Column,
Entity,
2021-07-17 16:44:34 +02:00
PrimaryColumn,
2021-07-08 23:58:07 +02:00
Tree,
TreeChildren,
TreeParent,
} from 'typeorm';
2021-07-08 19:40:14 +02:00
@Entity()
2021-07-08 23:58:07 +02:00
@Tree('closure-table', {
closureTableName: 'item_closure',
})
2021-07-08 19:40:14 +02:00
export class Item {
2021-07-17 16:44:34 +02:00
@PrimaryColumn({ type: 'bigint' })
2021-07-08 23:58:07 +02:00
id: string;
2021-07-08 19:40:14 +02:00
@Column()
name: string;
@Column({ nullable: true })
notes?: string;
2021-07-08 23:58:07 +02:00
@TreeParent()
parent?: Item;
@TreeChildren()
children: Item[];
2021-07-08 19:40:14 +02:00
}