- corretto gruppomacro catalogo, info prodotti, estrazione dati da amazon corretto.

This commit is contained in:
Surya Paolo
2025-09-27 17:24:46 +02:00
parent 08cf4b6d9f
commit 1d52ab1d08
10 changed files with 214 additions and 165 deletions

View File

@@ -293,7 +293,6 @@ const productSchema = new Schema({
],
price_acquistato: {
type: Number,
required: true,
},
after_price: {
type: String,
@@ -1379,15 +1378,13 @@ module.exports.resetImageNotFound = async function () {
module.exports.removeProductInfoWithoutDateUpdatedFromGM = async function (idapp) {
const Product = this;
const globalTables = require('../tools/globalTables');
let mylog;
try {
const arrproduct = await Product.find({ idapp, 'productInfo.date_updated_fromGM': { $exists: false } });
if (arrproduct.length > 0 && arrproduct.length < 1000) {
mylog = `Rimuovo ${arrproduct.length} productInfo senza date_updated_fromGM !!`
mylog = `Rimuovo ${arrproduct.length} product senza date_updated_fromGM !!`
console.log(mylog);
for (const product of arrproduct) {
@@ -1406,3 +1403,31 @@ module.exports.removeProductInfoWithoutDateUpdatedFromGM = async function (idapp
return mylog;
};
module.exports.HideProductInfoWithoutDateUpdatedFromGM = async function (idapp) {
const Product = this;
let mylog;
try {
const arrproduct = await Product.find({ idapp, 'productInfo.date_updated_fromGM': { $exists: false } });
if (arrproduct.length > 0 && arrproduct.length < 1000) {
mylog = `Nascondo ${arrproduct.length} product senza date_updated_fromGM !!`
console.log(mylog);
for (const product of arrproduct) {
await Product.updateOne(
{ _id: product._id },
{ $unset: { date_updated_fromGM: true } }
);
}
}
return mylog;
} catch (error) {
mylog += 'Error Hide productInfo without date_updated_fromGM:' + error;
console.error(mylog);
}
return mylog;
};