This commit is contained in:
2025-12-15 11:15:08 +03:30
parent 9d677622f2
commit b776f2b83a
12 changed files with 80 additions and 60 deletions
@@ -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;