Gestione Ordini: evaso...

This commit is contained in:
Surya Paolo
2023-12-13 19:17:53 +01:00
parent a2bd4f6e97
commit fcdd826c54
11 changed files with 314 additions and 125 deletions

View File

@@ -42,6 +42,41 @@ const orderSchema = new Schema({
quantity: {
type: Number
},
evaso: { // e quindi è stato tolto dal magazzino (aggiornando il campo StockQty)
type: Boolean,
default: false,
},
date_evaso: {
type: Date
},
pagato: {
type: Boolean,
default: false,
},
date_pagato: {
type: Date
},
spedito: {
type: Boolean,
default: false,
},
date_spedito: {
type: Date
},
completed: {
type: Boolean,
default: false,
},
date_completed: {
type: Date
},
consegnato: {
type: Boolean,
default: false,
},
date_consegnato: {
type: Date
},
weight: {
type: Number
},
@@ -148,6 +183,14 @@ module.exports.updateStatusOrders = async function (arrOrders, status) {
}
module.exports.updateStatusOrdersElements = async function (arrOrders, myelements) {
for (const order of arrOrders) {
const ret = await this.findOneAndUpdate({ _id: order._id }, { $set: myelements });
}
}
module.exports.getTotalOrderById = async function (id) {
const query = [
{ $match: { _id: ObjectID(id) } },