Inventoty will be updated right after an newItem/updateItem/deleteItem for pre pay orders
inventoryObj() {
const changeInQuantity = -this.item.count;
const inventoryItemId = this.item.priceId;
return { changeInQuantity, inventoryItemId };
}
inventoryObj() {
const changeInQuantity = this.currentItem.quantity - this.item.count;
const inventoryItemId = this.item.priceId;
return { changeInQuantity, inventoryItemId };
}
inventoryObj() {
return {
changeInQuantity: this.item.quantity,
inventoryItemId: this.item.inventoryId,
};
}
async updateInventory() {
const updatedItems = this.updatedInventory.map((item) => (
InventoryItems.query(this.transaction).patch({
quantity: raw(`quantity + ${item.changeInQuantity}`),
}).findById(item.inventoryItemId)
));
await Promise.all(updatedItems);
}
what happens if you go through with the order adjustment but the payment hasn't occurred? should we be adjusting the available inventory of a product then or after we complete payment?