Corretto Ordini e visualizzazione dei Totali
This commit is contained in:
@@ -180,30 +180,33 @@ module.exports.getOrderByID = function (id, callback) {
|
||||
}
|
||||
|
||||
module.exports.createOrder = async function (order) {
|
||||
const orderModel = new Order(order);
|
||||
|
||||
return await orderModel.save(order)
|
||||
.then((ris) => {
|
||||
if (!!ris)
|
||||
return ris._id;
|
||||
return null;
|
||||
});
|
||||
try {
|
||||
return await Order.create(order)
|
||||
.then((ris) => {
|
||||
if (!!ris)
|
||||
return ris._id;
|
||||
return null;
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('err', e);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.updateStatusOrders = async function (arrOrders, status) {
|
||||
|
||||
|
||||
for (const order of arrOrders) {
|
||||
const ret = await this.findOneAndUpdate({ _id: order._id }, { $set: 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) {
|
||||
|
||||
Reference in New Issue
Block a user