- Conversione Codice... Errore Service Worker regostration.

- Sistemare quasar.config.ts di piuchebuono!
-Le categorie non si vedono piu !!
This commit is contained in:
Surya Paolo
2025-03-06 01:23:56 +01:00
parent f6d8e1bb0b
commit 6270991b76
22 changed files with 142 additions and 45 deletions

View File

@@ -42,13 +42,7 @@ AdTypeSchema.pre('save', async function (next) {
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
const AdType = this;
const query = [
{$sort: {_id: 1}},
];
return await AdType.aggregate(query).then((arrrec) => {
return arrrec;
});
return AdType.find({}).sort({_id: 1}).lean();
};

View File

@@ -45,7 +45,7 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CashCategory.find(myfind);
return await CashCategory.find(myfind).lean();
};
module.exports.getAllCashCategory = function (query, sort, callback) {

View File

@@ -43,7 +43,7 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CashSubCategory.find(myfind);
return await CashSubCategory.find(myfind).lean();
};
module.exports.getAllCashSubCategory = function (query, sort, callback) {

View File

@@ -49,7 +49,7 @@ CatAISchema.statics.executeQueryTable = function (idapp, params) {
CatAISchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CatAI.find(myfind).sort({ name: 1 });
return await CatAI.find(myfind).sort({ name: 1 }).lean();
};
const CatAI = mongoose.model('CatAI', CatAISchema);

View File

@@ -45,7 +45,7 @@ CategorySchema.statics.executeQueryTable = function (idapp, params) {
CategorySchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Category.find(myfind);
return await Category.find(myfind).lean();
};
const Category = mongoose.model('Category', CategorySchema);

View File

@@ -55,7 +55,7 @@ CatProdSchema.statics.executeQueryTable = function (idapp, params) {
CatProdSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CatProd.find(myfind).sort({ name: 1 });
return await CatProd.find(myfind).sort({ name: 1 }).lean();
};
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {

View File

@@ -270,7 +270,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
const whatToShow = this.getWhatToShow(idapp, '');
return await Circuit.find(myfind, whatToShow).lean().sort({ name: 1 });
return await Circuit.find(myfind, whatToShow).sort({ name: 1 }).lean();
};
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {

View File

@@ -200,7 +200,7 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
CitySchema.statics.findAllIdApp = async function (idapp) {
const myfind = {};
return await City.find(myfind);
return await City.find(myfind).lean();
};
CitySchema.statics.getGeoJsonByProvince = async function (prov) {

View File

@@ -45,6 +45,6 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Department.find(myfind);
return await Department.find(myfind).lean();
};

View File

@@ -44,7 +44,7 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Group.find(myfind);
return await Group.find(myfind).lean();
};
module.exports.createIndexes()

View File

@@ -55,9 +55,7 @@ LevelSchema.statics.findAllIdApp = async function(idapp) {
{$sort: {_id: 1}},
];
return await Level.aggregate(query).then((arrrec) => {
return arrrec;
});
return Level.aggregate(query);
};

View File

@@ -143,9 +143,7 @@ MyBachecaSchema.statics.findAllIdApp = async function (idapp) {
{ $sort: { descr: 1 } },
];
return await MyBacheca.aggregate(query).then((arrrec) => {
return arrrec;
});
return await MyBacheca.aggregate(query);
};

View File

@@ -162,7 +162,7 @@ MyGroupSchema.pre('save', async function (next) {
MyGroupSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await MyGroup.find(myfind);
return await MyGroup.find(myfind).lean();
};
MyGroupSchema.statics.findAllGroups = async function (idapp) {

View File

@@ -56,7 +56,7 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Producer.find(myfind);
return await Producer.find(myfind).lean();
};
module.exports.getAllProducers = function (query, sort, callback) {

View File

@@ -844,9 +844,9 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
try {
let arr = [];
const result = await Product.aggregate(myquery);
arr = await Product.aggregate(myquery);
arr = result.map(category => category.name);
// arr = result.map(category => category.name);
return arr;
} catch (e) {
console.error('err', e);

View File

@@ -129,7 +129,7 @@ ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) {
ProvinceSchema.statics.findAllIdApp = async function (idapp) {
const myfind = {};
return Province.find(myfind).sort({ descr: 1 });
return Province.find(myfind).sort({ descr: 1 }).lean();
};
ProvinceSchema.statics.setCoordinatesOnDB = async function () {

View File

@@ -55,7 +55,7 @@ SubCatProdSchema.statics.executeQueryTable = function (idapp, params) {
SubCatProdSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await SubCatProd.find(myfind).sort({ name: 1 });
return SubCatProd.find(myfind).sort({ name: 1 }).lean();
};
const SubCatProd = mongoose.model('SubCatProd', SubCatProdSchema);

View File

@@ -69,18 +69,13 @@ module.exports = {
console.log('ADDING: ', query);
const { value: existingDoc, upserted } = await table.findOneAndUpdate(
query,
{ $set: rec },
{ upsert: true, new: true }
);
const newDoc = new table(rec);
const insertedDoc = await newDoc.save();
if (insertedDoc) {
console.log('Inserted document with _id:', insertedDoc._id);
if (upserted) {
// Il documento non esisteva, è stato creato
console.log('Inserted document with _id:', existingDoc._id);
numrec++;
} else {
console.log(' ... Non inserito !')
console.log(' ... Non inserito !');
}
} else {
@@ -95,7 +90,7 @@ module.exports = {
}
if (numrec > 0 || numupdated > 0) {
console.log(`*** Inserted ${numrec} and updated ${numupdated} records in ${tablename}`);
console.log(`------- *** Inseriti ${numrec} e aggiornati ${numupdated} record in ${tablename} ------ `);
}
}
}

View File

@@ -2002,9 +2002,9 @@ function load(req, res, version) {
gasordines,
products,
productInfos,
catprods,
catprods, //45
subcatprods,
catprods_gas,
catprods_gas, //47
catAI,
authors,
publishers,