up
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
||||
import { Entity, Property, OneToOne } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||
import { Food } from '../../foods/entities/food.entity';
|
||||
|
||||
@Entity({ tableName: 'inventory' })
|
||||
@Unique({ properties: ['food', 'restaurant'] })
|
||||
export class Inventory extends BaseEntity {
|
||||
@ManyToOne(() => Food, { unique: true })
|
||||
@OneToOne(() => Food, food => food.inventory)
|
||||
food!: Food;
|
||||
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@Property({ type: 'int' })
|
||||
totalStock!: number;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user