- Corretta query di estrapolazione libri su GM (Marco)

- aggiornato bestseller su fatlast1Y
- non mostrare piu i libri che non hanno l'immagine (sul catalogo).
- metti online i compressi
This commit is contained in:
Surya Paolo
2025-06-16 19:36:57 +02:00
parent 5668c620da
commit 8c0619992b
9 changed files with 117 additions and 58 deletions

View File

@@ -250,13 +250,14 @@ CatalogSchema.statics.getCatalogById = async function (id) {
product.idProductInfo.code &&
product.idProductInfo.code !== '' &&
product.idProductInfo.imagefile &&
//product.idProductInfo.imagefile !== 'noimg.jpg' &&
product.idProductInfo.imagefile !== 'noimg.jpg' &&
!product.delete
);
if (catalog.lista_prodotti.length !== originalLength) {
await catalog.save();
}
}
const transformedArrRec = arrrec.map((catalog) => ({
...catalog.toObject(), // Converte il documento Mongoose in un oggetto JavaScript puro

View File

@@ -529,6 +529,23 @@ module.exports.setImgNotFound = async function (id) {
}
// imposta tutti i record con image_not_found: false
module.exports.resetImageNotFound = async function () {
try {
const ProductInfo = this;
await ProductInfo.updateMany(
{ image_not_found: true },
{ $set: { image_not_found: false } }
);
console.log('Flag image_not_found reset to false for all records');
return true;
} catch (error) {
console.error('Error resetting image_not_found flag:', error);
}
}
// crea una funzione che mi rimuove il record "product" che utilizza productInfo, nel caso in cui date_updated_fromGM non esista
module.exports.removeProductInfoWithoutDateUpdatedFromGM = async function (idapp) {
const ProductInfo = this;