fix: sync inventory items quantity with services.

This commit is contained in:
a.bouhuolia
2021-02-28 14:45:13 +02:00
parent 0fd5eb34c6
commit fb9d68c2cf
9 changed files with 147 additions and 210 deletions

View File

@@ -183,7 +183,7 @@ export default class InventoryAdjustmentService {
inventoryAdjustmentId: number
): Promise<void> {
// Retrieve the inventory adjustment or throw not found service error.
const adjustment = await this.getInventoryAdjustmentOrThrowError(
const oldInventoryAdjustment = await this.getInventoryAdjustmentOrThrowError(
tenantId,
inventoryAdjustmentId
);
@@ -208,6 +208,7 @@ export default class InventoryAdjustmentService {
await this.eventDispatcher.dispatch(events.inventoryAdjustment.onDeleted, {
tenantId,
inventoryAdjustmentId,
oldInventoryAdjustment
});
this.logger.info(
'[inventory_adjustment] the adjustment deleted successfully.',
@@ -317,7 +318,7 @@ export default class InventoryAdjustmentService {
});
});
// Saves the given inventory transactions to the storage.
this.inventoryService.recordInventoryTransactions(
await this.inventoryService.recordInventoryTransactions(
tenantId,
inventoryTransactions,
override