- 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

@@ -1,12 +1,12 @@
DATABASE=test_FreePlanet
DATABASE=test_PiuCheBuono
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
appTelegram_TEST=["1","13"]
appTelegram=["1","13"]
appTelegram_DEVELOP=["13"]
appTelegram_TEST=["1","17"]
appTelegram=["1","17"]
appTelegram_DEVELOP=["17"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=0
ENABLE_PUSHNOTIFICATION=1
@@ -38,4 +38,10 @@ FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123
SCRIPTS_DIR=admin_scripts
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
MIAB_HOST=box.lamiaposta.org
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
SERVER_A_URL="http://51.77.156.69:3000"
NODE_TLS_REJECT_UNAUTHORIZED="0"

53
scripts/esporta_dati.sh Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
# Definizione delle costanti
targetDB="FreePlanet"
MYDOCKER="mongodb_riso"
# Percorso del file da Esportare (specificare il percorso completo)
myCollection="$1"
fileToImport="$1.json"
# Leggi il nome della collezione come primo argomento
if [ -z "$1" ]; then
echo "Errore: Devi specificare il nome della collezione come argomento."
exit 1
fi
# Leggi le credenziali dal file di configurazione
source ~/batch/.my_cfg.ini
# Verifica che le variabili siano state impostate correttamente
if [ -z "$PWDDB" ]; then
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
exit 1
fi
# Messaggio di conferma
echo "Stai per Esportare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
# Controllo della risposta dell'utente
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
echo "Operazione annullata."
exit 0
fi
# Esegui il comando mongoimport dentro il container Docker
docker exec $MYDOCKER mongoexport \
--username admin \
--password "$PWDDB" \
--authenticationDatabase admin \
--db "$targetDB" \
--collection "$myCollection" \
--out "$fileToImport" \
# Verifica lo stato dell'operazione
if [ $? -eq 0 ]; then
echo "Esportazione completata con successo! $fileToImport"
else
echo "Errore durante l'esportazione."
exit 1
fi

53
scripts/importa_dati.sh Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
# Definizione delle costanti
targetDB="FreePlanet"
MYDOCKER="mongodb_riso"
# Percorso del file da importare (specificare il percorso completo)
myCollection="$1"
fileToImport="$1.json"
# Leggi il nome della collezione come primo argomento
if [ -z "$1" ]; then
echo "Errore: Devi specificare il nome della collezione come argomento."
exit 1
fi
# Leggi le credenziali dal file di configurazione
source ~/batch/.my_cfg.ini
# Verifica che le variabili siano state impostate correttamente
if [ -z "$PWDDB" ]; then
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
exit 1
fi
# Messaggio di conferma
echo "Stai per importare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
# Controllo della risposta dell'utente
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
echo "Operazione annullata."
exit 0
fi
# Esegui il comando mongoimport dentro il container Docker
docker exec $MYDOCKER mongoimport \
--username admin \
--password "$PWDDB" \
--authenticationDatabase admin \
--db "$targetDB" \
--collection "$myCollection" \
--file "$fileToImport" \
--jsonArray
# Verifica lo stato dell'operazione
if [ $? -eq 0 ]; then
echo "Importazione completata con successo!"
else
echo "Errore durante l'importazione."
exit 1
fi

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,