- Poter impostare per ogni Provincia un Circuito RIS specifico, anziché quello provinciale:

Esempio: Napoli: (Circuito RIS Campania) e Sud Sardegna: Cagliari.
This commit is contained in:
Surya Paolo
2025-07-21 19:08:43 +02:00
parent e118c30f47
commit a189aeb99c
5 changed files with 62 additions and 61 deletions

View File

@@ -1,12 +1,12 @@
DATABASE=test_PiuCheBuono DATABASE=test_FreePlanet
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","17"] appTelegram_TEST=["1","13"]
appTelegram=["1","17"] appTelegram=["1","13"]
appTelegram_DEVELOP=["17"] appTelegram_DEVELOP=["13"]
DOMAIN=mongodb://localhost:27017/ DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=0 AUTH_MONGODB=0
ENABLE_PUSHNOTIFICATION=1 ENABLE_PUSHNOTIFICATION=1
@@ -29,7 +29,7 @@ GCM_API_KEY=""
PROD=0 PROD=0
PROJECT_DESCR_MAIN='__PROJECTS' PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=Askb38v23jjDFaoskBOWj92axXCQ SECRK=Askb38v23jjDFaoskBOWj92axXCQ
TOKEN_LIFE=2h TOKEN_LIFE=1m
REFRESH_TOKEN_LIFE=14d REFRESH_TOKEN_LIFE=14d
FTPSERVER_HOST=139.162.166.31 FTPSERVER_HOST=139.162.166.31
FTPSERVER_PORT=21 FTPSERVER_PORT=21
@@ -38,9 +38,4 @@ 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"
SERVER_A_URL="http://51.77.156.69:3000"
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"

View File

@@ -13,11 +13,12 @@ const { ObjectId } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs'); const shared_consts = require('../tools/shared_nodejs');
// Resolving error Unknown modifier: $pushAll // Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => { mongoose.plugin((schema) => {
schema.options.usePushEach = true; schema.options.usePushEach = true;
}); });
const ProvinceSchema = new Schema({ const ProvinceSchema = new Schema(
{
_id: { _id: {
type: Number, type: Number,
}, },
@@ -29,6 +30,9 @@ const ProvinceSchema = new Schema({
// unique: true, // unique: true,
maxlength: 3, maxlength: 3,
}, },
idCircuitToAssign: {
type: String,
},
descr: { descr: {
type: String, type: String,
}, },
@@ -48,18 +52,16 @@ const ProvinceSchema = new Schema({
long: { long: {
type: Number, type: Number,
}, },
},
}, { _id: false }); { _id: false }
);
ProvinceSchema.pre('save', async function (next) { ProvinceSchema.pre('save', async function (next) {
if (this.isNew) { if (this.isNew) {
const myrec = await Province.findOne().limit(1).sort({ _id: -1 }); const myrec = await Province.findOne().limit(1).sort({ _id: -1 });
if (!!myrec) { if (!!myrec) {
if (myrec._doc._id === 0) if (myrec._doc._id === 0) this._id = 1;
this._id = 1; else this._id = myrec._doc._id + 1;
else
this._id = myrec._doc._id + 1;
} else { } else {
this._id = 1; this._id = 1;
} }
@@ -75,7 +77,7 @@ ProvinceSchema.statics.getRegionByStrProvince = async function (strprovince) {
} }
return ''; return '';
} };
ProvinceSchema.statics.getStrProvinceByProv = async function (prov) { ProvinceSchema.statics.getStrProvinceByProv = async function (prov) {
const myrec = await Province.findOne({ prov }).lean(); const myrec = await Province.findOne({ prov }).lean();
@@ -84,7 +86,7 @@ ProvinceSchema.statics.getStrProvinceByProv = async function (prov) {
} }
return ''; return '';
} };
ProvinceSchema.statics.getFieldsForSearch = function () { ProvinceSchema.statics.getFieldsForSearch = function () {
return [ return [
@@ -106,7 +108,6 @@ ProvinceSchema.statics.executeQueryTable = function (idapp, params) {
}; };
ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) { ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) {
const strfind = params.search; const strfind = params.search;
if (strfind === '') { if (strfind === '') {
@@ -123,7 +124,6 @@ ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) {
const ris = await Province.find(filterfind).lean().limit(10); const ris = await Province.find(filterfind).lean().limit(10);
return [...risexact, ...ris]; return [...risexact, ...ris];
}; };
ProvinceSchema.statics.findAllIdApp = async function (idapp) { ProvinceSchema.statics.findAllIdApp = async function (idapp) {
@@ -133,7 +133,6 @@ ProvinceSchema.statics.findAllIdApp = async function (idapp) {
}; };
ProvinceSchema.statics.setCoordinatesOnDB = async function () { ProvinceSchema.statics.setCoordinatesOnDB = async function () {
const arrprov = await Province.find({}).lean(); const arrprov = await Province.find({}).lean();
// Funzione per ottenere le coordinate di tutte le città // Funzione per ottenere le coordinate di tutte le città
@@ -141,20 +140,23 @@ ProvinceSchema.statics.setCoordinatesOnDB = async function () {
if (!prov.lat) { if (!prov.lat) {
let coord = await tools.getCityCoordinates(prov); let coord = await tools.getCityCoordinates(prov);
if (coord) { if (coord) {
let ris = await Province.findOneAndUpdate({ _id: prov._id }, { $set: { lat: coord.lat, long: coord.long } }, { new: true }); let ris = await Province.findOneAndUpdate(
{ _id: prov._id },
{ $set: { lat: coord.lat, long: coord.long } },
{ new: true }
);
console.log(' *** Update ', prov.descr, 'lat', ris.lat, 'long', ris.long); console.log(' *** Update ', prov.descr, 'lat', ris.lat, 'long', ris.long);
} }
} }
} }
}; };
const Province = mongoose.model('Province', ProvinceSchema); const Province = mongoose.model('Province', ProvinceSchema);
Province.createIndexes() Province.createIndexes()
.then(() => {}) .then(() => {})
.catch((err) => { throw err; }); .catch((err) => {
throw err;
});
module.exports = { Province }; module.exports = { Province };

View File

@@ -114,7 +114,7 @@ router.post('/', async (req, res) => {
user.surname = user.surname.trim(); user.surname = user.surname.trim();
if ((user.aportador_solidario === 'tuo_username') || (user.aportador_solidario === '{username}')) { if ((user.aportador_solidario === 'tuo_username') || (user.aportador_solidario === '{username}')) {
user.aportador_solidario = 'paoloar77'; user.aportador_solidario = 'surya1977';
} }
// tools.mylog("LANG PASSATO = " + user.lang, "IDAPP", user.idapp); // tools.mylog("LANG PASSATO = " + user.lang, "IDAPP", user.idapp);

View File

@@ -1763,10 +1763,14 @@ module.exports = {
try { try {
const { User } = require('../models/user'); const { User } = require('../models/user');
const queryadmins = { username: 'paoloar77', idapp }; let queryadmins = { username: 'paoloar77', idapp };
if (idapp === 0) idapp = '13'; if (idapp === 0) idapp = '13';
if (idapp === '13') { // this.RISO
queryadmins = { username: 'surya1977', idapp };
}
User.find(queryadmins).then(async (arrusers) => { User.find(queryadmins).then(async (arrusers) => {
if (arrusers !== null) { if (arrusers !== null) {
for (const user of arrusers) { for (const user of arrusers) {

View File

@@ -1 +1 @@
1.2.66 1.2.67