ver "0.5.9"

Saldo ora comprende anche le transazioni Pendenti (e le visualizza)
This commit is contained in:
Paolo Arena
2022-09-18 01:21:04 +02:00
parent 7b16362553
commit 9d072d4d0d
6 changed files with 85 additions and 16 deletions

View File

@@ -118,7 +118,7 @@ sendNotifSchema.statics.getRecNotif = function(id) {
try {
return SendNotif.findById(id).lean();
}catch (e) {
} catch (e) {
return null;
}
@@ -335,7 +335,8 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = function(recnotif) {
recnotif.paramsObj.username_action);
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,
newdescr = i18n.__('ID_CIRCUIT_COINS_ACCEPTED_TO_ME', recnotif.paramsObj.extrarec.qty.toString(),
recnotif.paramsObj.extrarec.symbol,
recnotif.paramsObj.extrarec.dest);
tag = 'sendcoin';
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED) {
@@ -832,6 +833,27 @@ sendNotifSchema.statics.sendToSingleUserDest = async function(myrecnotif, req, r
};
sendNotifSchema.statics.getSumPendingTransactions = async function(idapp, username, circuitname) {
const SendNotif = this;
try {
const query = {
idapp,
sender: username,
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
status: 0,
'extrarec.circuitname': circuitname,
};
return await SendNotif.find(query).lean();
} catch (e) {
console.error('e', e);
}
};
const SendNotif = mongoose.model('SendNotif', sendNotifSchema);
module.exports = {SendNotif: SendNotif};