Riattivato il Calendario (ma ancora non lo rendo visibile)

aggiunto campi: DateTimeStart e DateTimeEnd negli Eventi
Aggiunto Filtro Data
This commit is contained in:
paoloar77
2022-02-24 19:13:20 +01:00
parent 3be7453b2e
commit aa8dd7ddff
4 changed files with 60 additions and 16 deletions

View File

@@ -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';
},
};