- corretto gruppomacro catalogo, info prodotti, estrazione dati da amazon corretto.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user