- ordinamento aggiornare la pagina "templates" per Fatturati ultimo anno
- bestseller
This commit is contained in:
@@ -34,6 +34,9 @@ const CatProdSchema = new Schema({
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
quanti: {
|
||||
type: Number,
|
||||
}
|
||||
});
|
||||
|
||||
CatProdSchema.statics.getAllCategories = function (callback) {
|
||||
@@ -148,6 +151,13 @@ CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
|
||||
|
||||
const result = await CatProd.aggregate(myquery);
|
||||
|
||||
for (const record of result) {
|
||||
await CatProd.updateOne(
|
||||
{ _id: record._id },
|
||||
{ $set: { quanti: record.quanti } }
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error retrieving CatProd with title count:', error);
|
||||
|
||||
Reference in New Issue
Block a user