- edit campi prodotti

- edit ordini
This commit is contained in:
Surya Paolo
2024-01-13 00:28:53 +01:00
parent c63e345285
commit 7bf549569d
6 changed files with 126 additions and 8 deletions

View File

@@ -360,7 +360,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
const { User } = require('../models/user');
let orderCart = await OrdersCart.findOne({ idapp, _id: order_id }).lean();
let orderscart = await OrdersCart.findOne({ idapp, _id: order_id }).lean();
if ((userId !== String(req.user._id)) && !User.isManager(req.user.perm)) {
// I'm trying to write something not mine!
@@ -368,19 +368,19 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
}
try {
if (!!orderCart) {
if (!!orderscart) {
let fields_to_update = { status };
await OrdersCart.findOneAndUpdate({ _id: order_id }, { $set: fields_to_update }
, { new: false })
.then(async (ris) => {
const userDest = await User.findById(orderCart.userId).lean();
const userDest = await User.findById(ordersCart.userId).lean();
if (ris) {
// Aggiorna gli Stati Interni !
orderCart = await OrdersCart.updateCmd(orderCart, status, true, options);
ordersCart = await OrdersCart.updateCmd(ordersCart, status, true, options);
let ordertype = '';
@@ -393,7 +393,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
}
if (ordertype !== '') {
sendemail.sendEmail_Order(userDest.lang, idapp, orderCart, userDest, ordertype, status)
sendemail.sendEmail_Order(userDest.lang, idapp, ordersCart, userDest, ordertype, status)
.then((ris) => {
})