- Conversione Codice... Errore Service Worker regostration.
- Sistemare quasar.config.ts di piuchebuono! -Le categorie non si vedono piu !!
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
DATABASE=test_FreePlanet
|
DATABASE=test_PiuCheBuono
|
||||||
UDB=paofreeplanet
|
UDB=paofreeplanet
|
||||||
PDB=mypassword@1A
|
PDB=mypassword@1A
|
||||||
SEND_EMAIL=0
|
SEND_EMAIL=0
|
||||||
SEND_EMAIL_ORDERS=1
|
SEND_EMAIL_ORDERS=1
|
||||||
PORT=3000
|
PORT=3000
|
||||||
appTelegram_TEST=["1","13"]
|
appTelegram_TEST=["1","17"]
|
||||||
appTelegram=["1","13"]
|
appTelegram=["1","17"]
|
||||||
appTelegram_DEVELOP=["13"]
|
appTelegram_DEVELOP=["17"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=0
|
AUTH_MONGODB=0
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
@@ -38,4 +38,10 @@ FTPSERVER_PWD=ftpmypwd@1A_
|
|||||||
AUTH_NEW_SITES=123123123
|
AUTH_NEW_SITES=123123123
|
||||||
SCRIPTS_DIR=admin_scripts
|
SCRIPTS_DIR=admin_scripts
|
||||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
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"
|
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
53
scripts/esporta_dati.sh
Normal 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
53
scripts/importa_dati.sh
Normal 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
|
||||||
@@ -42,13 +42,7 @@ AdTypeSchema.pre('save', async function (next) {
|
|||||||
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
|
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
|
||||||
const AdType = this;
|
const AdType = this;
|
||||||
|
|
||||||
const query = [
|
return AdType.find({}).sort({_id: 1}).lean();
|
||||||
{$sort: {_id: 1}},
|
|
||||||
];
|
|
||||||
|
|
||||||
return await AdType.aggregate(query).then((arrrec) => {
|
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CashCategory.find(myfind);
|
return await CashCategory.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllCashCategory = function (query, sort, callback) {
|
module.exports.getAllCashCategory = function (query, sort, callback) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CashSubCategory.find(myfind);
|
return await CashSubCategory.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ CatAISchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CatAISchema.statics.findAllIdApp = async function (idapp) {
|
CatAISchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { 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);
|
const CatAI = mongoose.model('CatAI', CatAISchema);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ CategorySchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CategorySchema.statics.findAllIdApp = async function (idapp) {
|
CategorySchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Category.find(myfind);
|
return await Category.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
const Category = mongoose.model('Category', CategorySchema);
|
const Category = mongoose.model('Category', CategorySchema);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ CatProdSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CatProdSchema.statics.findAllIdApp = async function (idapp) {
|
CatProdSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { 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) {
|
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const whatToShow = this.getWhatToShow(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) {
|
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
|
|||||||
CitySchema.statics.findAllIdApp = async function (idapp) {
|
CitySchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = {};
|
const myfind = {};
|
||||||
|
|
||||||
return await City.find(myfind);
|
return await City.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
|
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Department.find(myfind);
|
return await Department.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Group.find(myfind);
|
return await Group.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes()
|
module.exports.createIndexes()
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ LevelSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
{$sort: {_id: 1}},
|
{$sort: {_id: 1}},
|
||||||
];
|
];
|
||||||
|
|
||||||
return await Level.aggregate(query).then((arrrec) => {
|
return Level.aggregate(query);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -143,9 +143,7 @@ MyBachecaSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
{ $sort: { descr: 1 } },
|
{ $sort: { descr: 1 } },
|
||||||
];
|
];
|
||||||
|
|
||||||
return await MyBacheca.aggregate(query).then((arrrec) => {
|
return await MyBacheca.aggregate(query);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ MyGroupSchema.pre('save', async function (next) {
|
|||||||
MyGroupSchema.statics.findAllIdApp = async function (idapp) {
|
MyGroupSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await MyGroup.find(myfind);
|
return await MyGroup.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Producer.find(myfind);
|
return await Producer.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllProducers = function (query, sort, callback) {
|
module.exports.getAllProducers = function (query, sort, callback) {
|
||||||
|
|||||||
@@ -844,9 +844,9 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let arr = [];
|
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;
|
return arr;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('err', e);
|
console.error('err', e);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) {
|
|||||||
ProvinceSchema.statics.findAllIdApp = async function (idapp) {
|
ProvinceSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = {};
|
const myfind = {};
|
||||||
|
|
||||||
return Province.find(myfind).sort({ descr: 1 });
|
return Province.find(myfind).sort({ descr: 1 }).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
ProvinceSchema.statics.setCoordinatesOnDB = async function () {
|
ProvinceSchema.statics.setCoordinatesOnDB = async function () {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ SubCatProdSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
SubCatProdSchema.statics.findAllIdApp = async function (idapp) {
|
SubCatProdSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { 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);
|
const SubCatProd = mongoose.model('SubCatProd', SubCatProdSchema);
|
||||||
|
|||||||
@@ -69,18 +69,13 @@ module.exports = {
|
|||||||
|
|
||||||
console.log('ADDING: ', query);
|
console.log('ADDING: ', query);
|
||||||
|
|
||||||
const { value: existingDoc, upserted } = await table.findOneAndUpdate(
|
const newDoc = new table(rec);
|
||||||
query,
|
const insertedDoc = await newDoc.save();
|
||||||
{ $set: rec },
|
if (insertedDoc) {
|
||||||
{ upsert: true, new: true }
|
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 {
|
} else {
|
||||||
console.log(' ... Non inserito !')
|
console.log(' ... Non inserito !');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -95,7 +90,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (numrec > 0 || numupdated > 0) {
|
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} ------ `);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2002,9 +2002,9 @@ function load(req, res, version) {
|
|||||||
gasordines,
|
gasordines,
|
||||||
products,
|
products,
|
||||||
productInfos,
|
productInfos,
|
||||||
catprods,
|
catprods, //45
|
||||||
subcatprods,
|
subcatprods,
|
||||||
catprods_gas,
|
catprods_gas, //47
|
||||||
catAI,
|
catAI,
|
||||||
authors,
|
authors,
|
||||||
publishers,
|
publishers,
|
||||||
|
|||||||
Reference in New Issue
Block a user