refactor step 2

This commit is contained in:
2025-12-15 12:35:29 +03:30
parent b776f2b83a
commit 184ceb4800
10 changed files with 111 additions and 182 deletions
@@ -1,10 +1,13 @@
import { Entity, Property, OneToOne } from '@mikro-orm/core';
import { Cascade, Entity, Property, OneToOne } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Food } from '../../foods/entities/food.entity';
@Entity({ tableName: 'inventory' })
export class Inventory extends BaseEntity {
@OneToOne(() => Food, food => food.inventory)
@OneToOne(() => Food, {
cascade: [Cascade.ALL],
orphanRemoval: true,
})
food!: Food;
@Property({ type: 'int' })