Aggiunto comune, + filtro regione e provincia

aggiunto Visibilità (da fare check)
This commit is contained in:
Paolo Arena
2022-09-18 20:17:24 +02:00
parent 9d072d4d0d
commit bcb276518f
12 changed files with 127 additions and 19 deletions

View File

@@ -51,6 +51,10 @@ const sendNotifSchema = new Schema({
datenotif: {
type: Date,
},
date_created: {
type: Date,
default: Date.now,
},
status: {
type: Number,
default: 0,
@@ -144,7 +148,7 @@ sendNotifSchema.statics.findAllNotifByUsernameIdAndIdApp = function(username, la
};
sendNotifSchema.statics.getDescrAndLinkByRecNotif = function(recnotif) {
sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function(recnotif) {
const numchars = 80;
let newdescr = '';
@@ -321,7 +325,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = function(recnotif) {
}
tag = 'removeadmincircuit';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ) {
newdescr = i18n.__('CIRCUIT_SENDCOINSREQ', recnotif.paramsObj.username_action, recnotif.paramsObj.extrarec.qty.toString(),
newdescr = i18n.__('CIRCUIT_SENDCOINSREQ', tools.getAhref(recnotif.paramsObj.username_action, await tools.getLinkUserTelegram(recnotif.idapp, recnotif.paramsObj.username_action)), recnotif.paramsObj.extrarec.qty.toString(),
recnotif.paramsObj.extrarec.symbol);
tag = 'sendcoin';
recnotif.openUrl = '/circuit/' + recnotif.paramsObj.path; //++Todo: dove lo mando ?
@@ -332,12 +336,15 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = function(recnotif) {
recnotif.openUrl = '/circuit/' + recnotif.paramsObj.path; //++Todo: dove lo mando ?
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED) {
newdescr = i18n.__('ID_CIRCUIT_COINS_ACCEPTED', recnotif.paramsObj.extrarec.qty.toString(), recnotif.paramsObj.extrarec.symbol,
recnotif.paramsObj.username_action);
recnotif.paramsObj.username_action) + `\n` + i18n.__('SALDO_UPDATE', recnotif.paramsObj.extrarec.saldoDest,
recnotif.paramsObj.extrarec.symbol
);
tag = 'sendcoin';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED_SENT) {
newdescr = i18n.__('ID_CIRCUIT_COINS_ACCEPTED_TO_ME', recnotif.paramsObj.extrarec.qty.toString(),
recnotif.paramsObj.extrarec.symbol,
recnotif.paramsObj.extrarec.dest);
recnotif.paramsObj.extrarec.dest) + `\n` + i18n.__('SALDO_UPDATE', recnotif.paramsObj.extrarec.saldoOrig,
recnotif.paramsObj.extrarec.symbol);
tag = 'sendcoin';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED) {
newdescr = i18n.__('ID_CIRCUIT_COINS_REFUSED', recnotif.paramsObj.extrarec.qty.toString(), recnotif.paramsObj.extrarec.symbol,
@@ -346,7 +353,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = function(recnotif) {
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED_SENT) {
newdescr = i18n.__('ID_CIRCUIT_COINS_REFUSED_TO_ME', recnotif.paramsObj.extrarec.qty.toString(), recnotif.paramsObj.extrarec.symbol,
recnotif.paramsObj.extrarec.dest);
tag = 'sendcoin';
tag = 'sendcoin';ac
}
}
@@ -451,7 +458,7 @@ sendNotifSchema.statics.updateStatusAndDescr = async function(myrecnotif, onlysa
try {
if (!myrecnotif.openUrl) {
// If not exist, then I set openUrl and description
myrecnotif = this.getDescrAndLinkByRecNotif(myrecnotif);
myrecnotif = await this.getDescrAndLinkByRecNotif(myrecnotif);
}
let newstatus = 0;
@@ -523,8 +530,9 @@ sendNotifSchema.statics.updateStatusAndDescr = async function(myrecnotif, onlysa
if (newstatus) {
const fields_to_update = {
status: newstatus,
read: true,
read: false,
descr: myrecnotif.descr,
datenotif: new Date(),
};
let query = {
@@ -753,7 +761,7 @@ sendNotifSchema.statics.sendToTheDestinations = async function(myrecnotifpass, r
myrecnotifpass.myrectableorig = myrectableorig;
}
myrecnotifpass = this.getDescrAndLinkByRecNotif(myrecnotifpass);
myrecnotifpass = await this.getDescrAndLinkByRecNotif(myrecnotifpass);
delete myrecnotifpass._doc['_id'];
for (const user of userlist) {