diff --git a/README.md b/README.md index ef6522a..3b2bcc3 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ You will need to download the root certificate (root.pem) and an intermediate ce See this article: https://www.psclistens.com/insight/blog/enabling-a-nodejs-ssl-webserver-using-let-s-encrypt-pem-certificates/ +and this, for the client: +https://smallstep.com/hello-mtls/doc/combined/nodejs/axios + To see if all the certificates are OK, see this page check and enter the correct host and port: https://decoder.link/sslchecker diff --git a/src/server/models/mybacheca.js b/src/server/models/mybacheca.js index 3381e20..2f540a4 100755 --- a/src/server/models/mybacheca.js +++ b/src/server/models/mybacheca.js @@ -41,6 +41,12 @@ const MyBachecaSchema = new Schema({ { type: Number, }], + dateTimeStart: { + type: Date, + }, + dateTimeEnd: { + type: Date, + }, numLevel: { type: Number, default: 0, @@ -145,6 +151,8 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params) { MyBacheca: 1, idStatusSkill: 1, idContribType: 1, + dateTimeStart: 1, + dateTimeEnd: 1, idCity: 1, numLevel: 1, adType: 1, @@ -232,6 +240,8 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) { 'idSubSkill': 1, 'idStatusSkill': 1, 'idContribType': 1, + dateTimeStart: 1, + dateTimeEnd: 1, 'idCity': 1, 'numLevel': 1, adType: 1, @@ -284,6 +294,8 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) { 'idSubSkill': 1, 'idStatusSkill': 1, 'idContribType': 1, + dateTimeStart: 1, + dateTimeEnd: 1, 'idCity': 1, 'numLevel': 1, adType: 1, @@ -336,6 +348,8 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) { 'idSubSkill': 1, 'idStatusSkill': 1, 'idContribType': 1, + dateTimeStart: 1, + dateTimeEnd: 1, 'idCity': 1, 'numLevel': 1, adType: 1, @@ -388,6 +402,8 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) { // 'idSubSkill': 1, 'idStatusSkill': 1, 'idContribType': 1, + dateTimeStart: 1, + dateTimeEnd: 1, 'idCity': 1, 'numLevel': 1, adType: 1, @@ -440,6 +456,8 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) { // 'idSubSkill': 1, 'idStatusSkill': 1, 'idContribType': 1, + dateTimeStart: 1, + dateTimeEnd: 1, 'idCity': 1, 'numLevel': 1, adType: 1, diff --git a/src/server/populate/skills.js b/src/server/populate/skills.js index ead06ea..90a7bfa 100644 --- a/src/server/populate/skills.js +++ b/src/server/populate/skills.js @@ -17,7 +17,7 @@ module.exports = { {_id: 15, idSector: [3], descr: 'Autoproduzione alimenti e bevande'}, {_id: 16, idSector: [4], descr: 'Servizi per Cani'}, {_id: 17, idSector: [4], descr: 'Servizi per Gatti'}, - {_id: 18, idSector: [4], descr: 'Servizi per Anumali da allevamento'}, + {_id: 18, idSector: [4], descr: 'Servizi per Animali da allevamento'}, {_id: 19, idSector: [4], descr: 'Veterinario'}, {_id: 20, idSector: [5], descr: 'Riparazioni Auto'}, {_id: 21, idSector: [5], descr: 'Riparazioni Moto'}, @@ -102,5 +102,10 @@ module.exports = { {_id: 100, idSector: [13], descr: 'Realizzazione Siti web'}, {_id: 101, idSector: [13], descr: 'Realizzazione App / Piattaforme'}, {_id: 102, idSector: [13], descr: 'Corsi d\'Informatica'}, - {_id: 103, idSector: [13], descr: 'Riparazione Elettrodomestici'}], + {_id: 103, idSector: [13], descr: 'Riparazione Elettrodomestici'}, + {_id: 104, idSector: [12], descr: 'Infermiera'}, + {_id: 105, idSector: [12], descr: 'OSS'}, + {_id: 106, idSector: [10], descr: 'Badante'}, + {_id: 107, idSector: [6], descr: 'Massaggi'}, + ], }; diff --git a/src/server/tools/general.js b/src/server/tools/general.js index fb73e67..c5b6561 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -783,7 +783,7 @@ module.exports = { console.error('err Push', err.body); // Cancella dal DB la notifica Push, visto che da errore! (sarĂ  scaduto) - const ris = await Subscription.deleteOne({_id: subscription._id }); + const ris = await Subscription.deleteOne({_id: subscription._id}); reject({ status: false, @@ -807,7 +807,8 @@ module.exports = { }, - sendNotificationByUsername: async function(idapp, username, cmd, telegram, usernameOrig) { + sendNotificationByUsername: async function( + idapp, username, cmd, telegram, usernameOrig) { var {User} = require('../models/user'); @@ -1211,7 +1212,7 @@ module.exports = { let query = []; const myfilters = []; - for (const rec of fieldsearch){ + for (const rec of fieldsearch) { let data = {}; if (rec.type === this.FieldType.exact) { data[rec.field] = filter.trim(); @@ -1248,8 +1249,8 @@ module.exports = { if (params.filter && params.fieldsearch) { const querytemp = this.getFilterParam(params.filter, params.fieldsearch); - if (querytemp){ - query = [...query, ...querytemp] + if (querytemp) { + query = [...query, ...querytemp]; } } @@ -1384,6 +1385,16 @@ module.exports = { } if (myfilter['_idOBJ']) { filtriadded.push({_id: ObjectID(myfilter['_idOBJ'])}); + } else if (myfilter['dateTimeStart']) { + const gte = myfilter['dateTimeStart'].$gte; + const lte = myfilter['dateTimeStart'].$lte; + let condition = { + dateTimeStart: { + $gte: new Date(gte), + $lte: new Date(lte), + }, + }; + filtriadded.push(condition); } else { filtriadded.push(myfilter); } @@ -1524,9 +1535,10 @@ module.exports = { } if (params.filter && params.fieldsearch_last) { - const querytemp = this.getFilterParam(params.filter, params.fieldsearch_last); - if (querytemp){ - query = [...query, ...querytemp] + const querytemp = this.getFilterParam(params.filter, + params.fieldsearch_last); + if (querytemp) { + query = [...query, ...querytemp]; } } @@ -1609,7 +1621,7 @@ module.exports = { } }); - }catch (e) { + } catch (e) { console.error('e', e); } @@ -2167,7 +2179,7 @@ module.exports = { let img_small = path.dirname(mypath) + '/' + server_constants.PREFIX_IMG_SMALL + path.basename(mypath); fs.unlink(img_small, () => {}); - console.log('delete file', mypath) + console.log('delete file', mypath); } catch (e) { console.error(err); } @@ -2357,7 +2369,14 @@ module.exports = { }, blockwords(mystr) { - const arrwords = ['http', 'Http', 'Asasfasfas', '://', 'mrbit', 'admin', 'superuser']; + const arrwords = [ + 'http', + 'Http', + 'Asasfasfas', + '://', + 'mrbit', + 'admin', + 'superuser']; try { for (const myword of arrwords) { if (mystr) { @@ -2498,7 +2517,7 @@ module.exports = { }, getNomeCognomeEUserNameByUser(user) { - let nome = `${user.name} ${user.surname} (${user.username})` + let nome = `${user.name} ${user.surname} (${user.username})`; if (!user.name) { nome = user.username; } @@ -2507,8 +2526,7 @@ module.exports = { }, sulServer() { - return process.env.LOCALE !== '1' + return process.env.LOCALE !== '1'; }, - };