aggio query

This commit is contained in:
Surya Paolo
2023-12-12 15:42:41 +01:00
parent 5f3c8a65ea
commit a2bd4f6e97
4 changed files with 86 additions and 35 deletions

View File

@@ -38,7 +38,7 @@ router.get('/:userId', authenticate, async function (req, res, next) {
if (cart)
return res.send({ code: server_constants.RIS_CODE_OK, cart });
else
return res.send({ code: server_constants.RIS_CODE_OK, cart: null });
return res.send({ code: server_constants.RIS_CODE_OK, cart: null });
}).catch((err) => {
console.error('Err', err);
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null });
@@ -214,11 +214,14 @@ router.post('/:userId/cartstatus', authenticate, async function (req, res, next)
created_at: new Date(),
modify_at: new Date(),
})
return await OrdersCart.updateOrdersCartById(-1, newOrderCart, function (err, ris) {
return await OrdersCart.updateOrdersCartById(-1, newOrderCart, async function (err, ris) {
//if (err) return next(err)
if (err)
return res.send({ code: server_constants.RIS_CODE_ERR, status: 0 });
else {
await Product.updateStatusOrders(mycart.items, status);
const myris = ris;
// Cancella il Cart appena salvato in OrdersCart