- Aggiornato node.js alla versione 22.18.1

- Aggiornato tutti i pacchetti del server all'ultima versione.
- passato mongoose da versione 5 a versione 6
This commit is contained in:
Surya Paolo
2025-03-03 00:46:08 +01:00
parent 45d06b0923
commit 53a70a1c96
120 changed files with 3385 additions and 6065 deletions

View File

@@ -131,9 +131,10 @@ const orderSchema = new Schema({
var Order = module.exports = mongoose.model('Order', orderSchema);
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports.getFieldsForSearch = function () {
return []
@@ -377,7 +378,7 @@ module.exports.updateTotals = function (order) {
module.exports.getTotalOrderById = async function (id) {
const query = [
{ $match: { _id: ObjectId(id) } },
{ $match: { _id: new ObjectId(id) } },
{
$lookup: {
from: 'products',
@@ -642,7 +643,7 @@ module.exports.RemoveDeletedOrdersInOrderscart = async function () {
if (!orderCart) {
// NON TROVATO ! Allora lo cancello
await Order.findOneAndRemove({ _id: ord._id });
await Order.findOneAndDelete({ _id: ord._id });
}
})
.catch(err => console.error(err));
@@ -660,7 +661,7 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
const myquery = [
{ $match: { idGasordine: ObjectId(myidGasordine) } },
{ $match: { idGasordine: new ObjectId(myidGasordine) } },
{
$lookup: {
from: 'products',