Trần Viết Sơn
add branch and branch menu
f97bd0c
raw
history blame
838 Bytes
import {
BaseEntity,
Column,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
Relation,
} from 'typeorm';
import { BranchEntity } from './branch.entity.js';
import { MenuItemEntity } from './menu-item.entity.js';
@Entity('branch_menu')
export class BranchMenuEntity extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
branch_id: string;
@Column()
menu_id: string;
@Column({ nullable: true })
description: string;
@Column({ default: true })
is_open: boolean;
@ManyToOne(() => BranchEntity, (a) => a.menu_items)
@JoinColumn({ name: 'branch_id' })
branch: Relation<BranchEntity>;
@ManyToOne(() => MenuItemEntity, (a) => a.branch_menus)
@JoinColumn({ name: 'menu_id' })
menu_item: Relation<MenuItemEntity>;
}