- aggiunto note 'note_ordine_gas'

- corretto bug
This commit is contained in:
Surya Paolo
2024-03-26 15:36:49 +01:00
parent bf1e9b83ba
commit 39687265c8
10 changed files with 83 additions and 14 deletions

View File

@@ -96,7 +96,7 @@ router.post('/:userId', authenticate, async function (req, res, next) {
} else if (subqty) {
myord = await newCart.subqty(order);
} else {
const ind = newCart.addItem(order);
const ind = await newCart.addItem(order);
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
}
@@ -104,7 +104,8 @@ router.post('/:userId', authenticate, async function (req, res, next) {
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
}
} else {
await newCart.updatecarttotals(true);
newCart.updatecarttotals(true);
await newCart.updateExtraOrder();
const arrord = await Order.getTotalOrderById(order._id);
myord = arrord ? arrord[0] : null;
}
@@ -162,7 +163,7 @@ router.delete('/:userId', authenticate, async function (req, res) {
// Rimuovere l'id sul Carrello
let newCart = CartClass.constructByCart(mycart);
newCart.removeItem(orderId);
await newCart.removeItem(orderId);
let carttot = null;
const cart = await Cart.updateCartByCartId(mycart._id, newCart.generateModel());
@@ -276,6 +277,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
totalQty: mycart.totalQty,
totalPrice: mycart.totalPrice,
totalPriceCalc: mycart.totalPriceCalc,
note_ordine_gas: mycart.note_ordine_gas,
userId,
status,
note,