Corretto incongruenze OrdersCart

This commit is contained in:
Surya Paolo
2023-12-21 01:34:33 +01:00
parent 7af909d2be
commit 2ab4bd4e2a
4 changed files with 110 additions and 18 deletions

View File

@@ -90,11 +90,13 @@ router.post('/:userId', authenticate, async function (req, res, next) {
myord = await newCart.subqty(order);
} else {
const ind = newCart.addItem(order);
myord = order;
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
}
} else {
await newCart.updatetotals();
myord = order;
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
}
cart = await Cart.updateCartByCartId(mycart._id, newCart.generateModel());
@@ -311,6 +313,15 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
})
}
})
} else if (status < shared_consts.OrderStatus.CHECKOUT_SENT) {
// Aggiorna il carrello !
/*const cartpao = await Cart.getCartByUserId(userId, idapp);
let newCart = CartClass.constructByCart(cartpao);
if (newCart)
await newCart.updatetotals();
newCart;*/
}
}