Lista Doni Navi

This commit is contained in:
Paolo Arena
2020-03-21 10:28:26 +01:00
parent fbc85ce06a
commit b2696d1898
139 changed files with 463 additions and 80 deletions

35
src/server/tools/general.js Normal file → Executable file
View File

@@ -30,6 +30,7 @@ const subject = process.env.URLBASE_APP1;
const publicVapidKey = process.env.PUBLIC_VAPI_KEY;
const privateVapidKey = process.env.PRIVATE_VAPI_KEY;
const FIELDS_REGEX = ['username', 'name', 'surname'];
// Code goes here
const keySize = 256;
@@ -197,6 +198,8 @@ module.exports = {
MEDIATORE: 'A1 💦 ',
SONOFUOCO: 0,
SONOACQUA: 3,
SONOTERRA: 2,
SONOARIA: 1,
},
FieldType: {
@@ -634,13 +637,18 @@ module.exports = {
let query = [];
if (params.filter && params.fieldsearch) {
let myregexp = {};
myregexp = new RegExp(params.filter.trim().replace(' ', '|'), "ig");
const myfilters = [];
params.fieldsearch.forEach((field) => {
params.fieldsearch.forEach((rec) => {
const data = {};
data[field] = myregexp;
if (rec.type === this.FieldType.string) {
data[rec.field] = myregexp;
} else if (rec.type === this.FieldType.number) {
data[rec.field] = parseInt(params.filter.trim());
}
myfilters.push(data);
});
@@ -819,6 +827,17 @@ module.exports = {
return mydate
},
AddDate(mydate, days) {
let date = new Date(mydate);
date.setTime(date.getTime() + days * 86400000);
return date;
},
getRigaColByPosUp(mypos) {
mypos.riga = mypos.riga - mypos.numup;
mypos.col = Math.ceil(mypos.col / (Math.pow(2, mypos.numup)));
},
appendLeadingZeroes(n) {
if (n <= 9) {
return "0" + n;
@@ -1086,6 +1105,18 @@ module.exports = {
}
}
if (table === 'navi') {
if ('link_chat' in fieldsvalue) {
return true;
}
if ('date_made_gift' in fieldsvalue) {
return true;
}
if ('made_gift' in fieldsvalue) {
return true;
}
}
return false;
},