diff --git a/.env.development b/.env.development index 076722d..7013049 100644 --- a/.env.development +++ b/.env.development @@ -1,12 +1,12 @@ -DATABASE=test_PiuCheBuono +DATABASE=test_FreePlanet UDB=paofreeplanet PDB=mypassword@1A SEND_EMAIL=0 SEND_EMAIL_ORDERS=1 PORT=3000 -appTelegram_TEST=["1","17"] -appTelegram=["1","17"] -appTelegram_DEVELOP=["17"] +appTelegram_TEST=["1","13"] +appTelegram=["1","13"] +appTelegram_DEVELOP=["13"] DOMAIN=mongodb://localhost:27017/ AUTH_MONGODB=0 ENABLE_PUSHNOTIFICATION=1 @@ -29,7 +29,7 @@ GCM_API_KEY="" PROD=0 PROJECT_DESCR_MAIN='__PROJECTS' SECRK=Askb38v23jjDFaoskBOWj92axXCQ -TOKEN_LIFE=2h +TOKEN_LIFE=1m REFRESH_TOKEN_LIFE=14d FTPSERVER_HOST=139.162.166.31 FTPSERVER_PORT=21 @@ -38,9 +38,4 @@ 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" -SERVER_A_URL="http://51.77.156.69:3000" -API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK" \ No newline at end of file diff --git a/src/server/models/province.js b/src/server/models/province.js index 3c74e1a..1a036c1 100755 --- a/src/server/models/province.js +++ b/src/server/models/province.js @@ -13,53 +13,55 @@ const { ObjectId } = require('mongodb'); const shared_consts = require('../tools/shared_nodejs'); // Resolving error Unknown modifier: $pushAll -mongoose.plugin(schema => { +mongoose.plugin((schema) => { schema.options.usePushEach = true; }); -const ProvinceSchema = new Schema({ - _id: { - type: Number, - }, - reg: { - type: String, - }, - prov: { - type: String, - // unique: true, - maxlength: 3, - }, - descr: { - type: String, - }, - link_grp: { - type: String, - }, - card: { - type: String, - }, +const ProvinceSchema = new Schema( + { + _id: { + type: Number, + }, + reg: { + type: String, + }, + prov: { + type: String, + // unique: true, + maxlength: 3, + }, + idCircuitToAssign: { + type: String, + }, + descr: { + type: String, + }, + link_grp: { + type: String, + }, + card: { + type: String, + }, - link_telegram: { - type: String, + link_telegram: { + type: String, + }, + lat: { + type: Number, + }, + long: { + type: Number, + }, }, - lat: { - type: Number, - }, - long: { - type: Number, - }, - -}, { _id: false }); + { _id: false } +); ProvinceSchema.pre('save', async function (next) { if (this.isNew) { const myrec = await Province.findOne().limit(1).sort({ _id: -1 }); if (!!myrec) { - if (myrec._doc._id === 0) - this._id = 1; - else - this._id = myrec._doc._id + 1; - + if (myrec._doc._id === 0) this._id = 1; + else this._id = myrec._doc._id + 1; } else { this._id = 1; } @@ -75,7 +77,7 @@ ProvinceSchema.statics.getRegionByStrProvince = async function (strprovince) { } return ''; -} +}; ProvinceSchema.statics.getStrProvinceByProv = async function (prov) { const myrec = await Province.findOne({ prov }).lean(); @@ -84,7 +86,7 @@ ProvinceSchema.statics.getStrProvinceByProv = async function (prov) { } return ''; -} +}; ProvinceSchema.statics.getFieldsForSearch = function () { return [ @@ -106,7 +108,6 @@ ProvinceSchema.statics.executeQueryTable = function (idapp, params) { }; ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) { - const strfind = params.search; if (strfind === '') { @@ -123,7 +124,6 @@ ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) { const ris = await Province.find(filterfind).lean().limit(10); return [...risexact, ...ris]; - }; ProvinceSchema.statics.findAllIdApp = async function (idapp) { @@ -133,7 +133,6 @@ ProvinceSchema.statics.findAllIdApp = async function (idapp) { }; ProvinceSchema.statics.setCoordinatesOnDB = async function () { - const arrprov = await Province.find({}).lean(); // Funzione per ottenere le coordinate di tutte le città @@ -141,20 +140,23 @@ ProvinceSchema.statics.setCoordinatesOnDB = async function () { if (!prov.lat) { let coord = await tools.getCityCoordinates(prov); 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); } } - } }; - const Province = mongoose.model('Province', ProvinceSchema); Province.createIndexes() - .then(() => { }) - .catch((err) => { throw err; }); - + .then(() => {}) + .catch((err) => { + throw err; + }); module.exports = { Province }; diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js index 5e9052d..0ff7ac2 100755 --- a/src/server/router/users_router.js +++ b/src/server/router/users_router.js @@ -114,7 +114,7 @@ router.post('/', async (req, res) => { user.surname = user.surname.trim(); 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); diff --git a/src/server/tools/general.js b/src/server/tools/general.js index 47da672..f0f942a 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -1763,10 +1763,14 @@ module.exports = { try { const { User } = require('../models/user'); - const queryadmins = { username: 'paoloar77', idapp }; + let queryadmins = { username: 'paoloar77', idapp }; if (idapp === 0) idapp = '13'; + if (idapp === '13') { // this.RISO + queryadmins = { username: 'surya1977', idapp }; + } + User.find(queryadmins).then(async (arrusers) => { if (arrusers !== null) { for (const user of arrusers) { diff --git a/src/server/version.txt b/src/server/version.txt index 47ddbf2..d5bad6d 100644 --- a/src/server/version.txt +++ b/src/server/version.txt @@ -1 +1 @@ -1.2.66 \ No newline at end of file +1.2.67 \ No newline at end of file