Debounce scheduling calculating items cost

This commit is contained in:
Ahmed Bouhuolia
2024-08-28 21:25:47 +02:00
parent 161d60393a
commit fc6ebfea5c
6 changed files with 61 additions and 39 deletions

View File

@@ -86,20 +86,14 @@ export default class InventorySubscriber {
private handleScheduleItemsCostOnInventoryTransactionsCreated = async ({
tenantId,
inventoryTransactions,
trx
trx,
}: IInventoryTransactionsCreatedPayload) => {
const inventoryItemsIds = map(inventoryTransactions, 'itemId');
runAfterTransaction(trx, async () => {
try {
await this.saleInvoicesCost.computeItemsCostByInventoryTransactions(
tenantId,
inventoryTransactions
);
} catch (error) {
console.error(error);
}
});
await this.saleInvoicesCost.computeItemsCostByInventoryTransactions(
tenantId,
inventoryTransactions
);
};
/**