remove lock on inventory

This commit is contained in:
2025-12-18 09:32:15 +03:30
parent 32ad4f58d5
commit d7b6c9d35c
+2 -2
View File
@@ -137,7 +137,7 @@ export class InventoryService {
bulkReserveFoodDto: BulkReserveFoodDto,
): Promise<Inventory[]> {
return em.transactional(async em => {
const { items } = bulkReserveFoodDto;
// Get all unique food IDs
const foodIds = [...new Set(items.map(item => item.foodId))];
@@ -160,7 +160,7 @@ export class InventoryService {
// Load all existing inventories in one query
const existingInventories = await em.find(Inventory, {
food: { id: { $in: foodIds } },
},{ lockMode: LockMode.PESSIMISTIC_WRITE });
});
const inventoryMap = new Map<string, Inventory>();
for (const inventory of existingInventories) {