inventory

This commit is contained in:
2025-12-14 23:02:55 +03:30
parent 996cd0016c
commit 0ac1b39100
16 changed files with 453 additions and 30 deletions
@@ -0,0 +1,20 @@
import { Entity, ManyToOne, Property, Unique } 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 })
food!: Food;
@ManyToOne(() => Restaurant)
restaurant!: Restaurant;
@Property({ type: 'int' })
totalStock!: number;
@Property({ type: 'int' })
availableStock!: number;
}