Aggiornamento cataloghi...

This commit is contained in:
Surya Paolo
2025-04-11 18:49:59 +02:00
parent e1ca4ef17f
commit 8e8a3204a7
13 changed files with 509 additions and 88 deletions

View File

@@ -819,6 +819,7 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
]
}
}]
} else {
addquery = [{ $match: { idapp } }];
}
@@ -841,7 +842,23 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
}
},
{ $unwind: "$category" },
{ $group: { _id: "$category._id", name: { $first: "$category.name" } } },
{
$group: {
_id: "$category._id",
name: { $first: "$category.name" },
idapp: { $first: "$category.idapp" },
idArgomento: { $first: "$category.idArgomento" }
}
},
{
$match: {
$or: [
{ idapp: { $ne: tools.MACRO } },
{ idapp: tools.MACRO, idArgomento: { $exists: true, $gt: 0 } }
]
}
},
{ $sort: { name: 1 } }
];