Lista Doni Navi
This commit is contained in:
35
src/server/tools/general.js
Normal file → Executable file
35
src/server/tools/general.js
Normal file → Executable 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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user