remove unused modules
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import type { EntityManager } from '@mikro-orm/core';
|
||||
import { Food } from '../modules/foods/entities/food.entity';
|
||||
import { product } from '../modules/products/entities/product.entity';
|
||||
import { Inventory } from '../modules/inventory/entities/inventory.entity';
|
||||
|
||||
export class InventorySeeder {
|
||||
async run(em: EntityManager): Promise<void> {
|
||||
const foods = await em.find(Food, {});
|
||||
const products = await em.find(product, {});
|
||||
|
||||
for (const food of foods) {
|
||||
// Check if inventory already exists for this food
|
||||
for (const product of products) {
|
||||
// Check if inventory already exists for this product
|
||||
const existingInventory = await em.findOne(Inventory, {
|
||||
food: { id: food.id },
|
||||
product: { id: product.id },
|
||||
});
|
||||
|
||||
if (!existingInventory) {
|
||||
const inventory = em.create(Inventory, {
|
||||
food,
|
||||
product,
|
||||
totalStock: 50,
|
||||
availableStock: 50,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user