Aggiornamento modifiche preOrdini

This commit is contained in:
Surya Paolo
2023-12-20 21:56:15 +01:00
12 changed files with 178 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ const OrdersCartSchema = new Schema({
numord_pers: { type: Number },
userId: { type: Schema.Types.ObjectId, ref: 'User' },
totalQty: { type: Number, default: 0 },
TotalPriceProduct: { type: Number, default: 0 },
totalQtyPreordered: { type: Number, default: 0 },
totalPrice: { type: Number, default: 0 },
department: {
@@ -270,9 +271,6 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp, numorder, fil
myorderscart = await OrdersCart.getOrdersCartByQuery(query);
// if (myorderscart)
// console.log('*** Num myorderscart ', myorderscart.length);
/*transform: function(doc, populated) {
// Rinomina 'idProduct' a 'product' nei risultati della popolazione
@@ -308,6 +306,7 @@ module.exports.updateOrdersCartById = function (id, newOrdersCart, callback) {
totalQty: newOrdersCart.totalQty,
totalQtyPreordered: newOrdersCart.totalQtyPreordered,
totalPrice: newOrdersCart.totalPrice,
totalPriceProduct: newOrdersCart.totalPriceProduct,
userId: userId,
status: newOrdersCart.status,
numorder: newOrdersCart.numorder,
@@ -475,7 +474,7 @@ module.exports.updateCmd = async function (ordersCart, status, value) {
// Aggiorna anche il Magazzino, togliendo le quantità in Stock
if (value) {
OrdersCart.updateStockQtaDalMagazzino(id);
await OrdersCart.updateStockQtaDalMagazzino(id);
}
ris = await OrdersCart.setEvasoById(value, myOrderCart);