- ver 1.2.47 :

- corretto errore di modifica scheda
- aggiunto scraping (fase 1)
This commit is contained in:
Surya Paolo
2025-05-16 10:26:55 +02:00
parent 1da0e0f4b5
commit 7e50299854
9 changed files with 194 additions and 38 deletions

View File

@@ -56,6 +56,9 @@ const MyPageSchema = new Schema({
only_residenti: {
type: Boolean,
},
only_admin: {
type: Boolean,
},
color: {
type: String,
},
@@ -200,6 +203,7 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
active: 1,
onlyif_logged: 1,
only_residenti: 1,
only_admin: 1,
inmenu: 1,
submenu: 1,
iconsize: 1,
@@ -227,6 +231,7 @@ MyPageSchema.statics.findInternalPages = async function (idapp) {
path: 1,
onlyif_logged: 1,
only_residenti: 1,
only_admin: 1,
}).lean();
return result;

View File

@@ -29,6 +29,9 @@ const productSchema = new Schema({
idapp: {
type: String,
},
delete: {
type: Boolean,
},
active: {
type: Boolean,
default: true,
@@ -462,7 +465,10 @@ module.exports.findAllIdApp = async function (idapp, code, id, all) {
}
if (idapp) {
myfind = { idapp };
myfind = {
idapp,
$or: [{ delete: { $exists: false } }, { delete: false }],
};
}
if (!all) {

View File

@@ -16,6 +16,9 @@ const productInfoSchema = new Schema({
idapp: {
type: String,
},
delete: {
type: Boolean,
},
department: {
type: String, ref: 'Department'
},
@@ -206,7 +209,13 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
try {
if (idapp)
myfind = { idapp };
myfind = {
idapp,
$or: [
{ delete: { $exists: false } },
{ delete: false }
]
};
if (code) {
myfind = { ...myfind, code }
@@ -539,11 +548,17 @@ module.exports.removeProductInfoWithoutDateUpdatedFromGM = async function (idapp
for (const productinfo of arrproductInfo) {
// cerca nella tabella Product se esiste idProductInfo = _id e cancella tutti i record che hanno questa corrispondenza
if (Product) {
await Product.deleteMany({ idProductInfo: productinfo._id });
await Product.updateMany(
{ idProductInfo: productinfo._id },
{ $set: { delete: true } }
);
}
// Ora rimuovi anche questo productInfo
await ProductInfo.deleteOne({ _id: productinfo._id });
await ProductInfo.updateOne(
{ _id: productinfo._id },
{ $set: { delete: true } }
);
}
}