remove lock on inventory
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user