- Aggiunto bottone Aggiungi al Carrello sulla lista dei libri dei cataloghi

This commit is contained in:
Surya Paolo
2025-06-06 00:07:53 +02:00
parent 28a4fe1952
commit f88f433003
11 changed files with 1661 additions and 1511 deletions

View File

@@ -58,9 +58,6 @@ const CatalogSchema = new Schema({
idPageAssigned: {
type: String,
},
idPageAssigned_stampa: {
type: String,
},
referenti: [
{
type: String,
@@ -169,7 +166,6 @@ CatalogSchema.statics.executeQueryTable = function (idapp, params, user) {
};*/
CatalogSchema.statics.findAllIdApp = async function (idapp) {
try {
const arrrec = await this.aggregate([
{ $match: { idapp } },
@@ -182,7 +178,6 @@ CatalogSchema.statics.findAllIdApp = async function (idapp) {
console.error('Errore:', err);
throw err;
}
};
CatalogSchema.statics.getCatalogById = async function (id) {
@@ -249,7 +244,15 @@ CatalogSchema.statics.getCatalogById = async function (id) {
// controlla prima se nella lista ci sono dei product che non esistono piu allora li devi rimuovere !
for (const catalog of arrrec) {
const originalLength = catalog.lista_prodotti.length;
catalog.lista_prodotti = catalog.lista_prodotti.filter((product) => product.idProductInfo);
catalog.lista_prodotti = catalog.lista_prodotti.filter(
(product) =>
product.idProductInfo &&
product.idProductInfo.code &&
product.idProductInfo.code !== '' &&
product.idProductInfo.imagefile &&
//product.idProductInfo.imagefile !== 'noimg.jpg' &&
!product.delete
);
if (catalog.lista_prodotti.length !== originalLength) {
await catalog.save();
}