- Transazioni Pendenti (all'Admin compaiono tutte quelle pendenti e con la possibilità di accettarle)
This commit is contained in:
@@ -674,6 +674,34 @@ sendNotifSchema.statics.findLastNotifCoinsByUserIdAndIdApp = function (username,
|
||||
|
||||
};
|
||||
|
||||
sendNotifSchema.statics.findAllNotifCoinsAllIdAndIdApp = function (idapp) {
|
||||
const SendNotif = this;
|
||||
|
||||
let filter = {
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
'extrarec.circuitname': { $ne: "Circuito di TEST" },
|
||||
'extrarec.symbol': { $ne: "RISTeST"},
|
||||
}
|
||||
|
||||
return SendNotif.aggregate([
|
||||
{
|
||||
$match: filter,
|
||||
},
|
||||
{
|
||||
$sort: { datenotif: -1 },
|
||||
},
|
||||
]).then(async (arrnotif) => {
|
||||
return this.compileOtherFields(arrnotif);
|
||||
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
sendNotifSchema.statics.saveAndSendNotif = async function (myrecnotif, req, res, user) {
|
||||
const SendNotif = this;
|
||||
|
||||
@@ -1248,6 +1276,40 @@ sendNotifSchema.statics.getSumPendingTransactionsDest = async function (idapp, u
|
||||
|
||||
};
|
||||
|
||||
sendNotifSchema.statics.RemovePendentTransactions = async function (idapp) {
|
||||
const SendNodif = this;
|
||||
|
||||
return await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
sendNotifSchema.statics.RemoveOldNotif = async function (idapp, numgg) {
|
||||
const SendNodif = this;
|
||||
|
||||
const currentDate = new Date();
|
||||
const limitDate = new Date(currentDate.setDate(currentDate.getDate() - numgg));
|
||||
|
||||
return await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
date_created: { $lt: limitDate },
|
||||
typedir: { $ne: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS },
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
sendNotifSchema.statics.RemoveOldNotif90 = async function (idapp) {
|
||||
return this.RemoveOldNotif90(idapp, 90);
|
||||
}
|
||||
|
||||
sendNotifSchema.statics.updatePendingTransactions = async function (recnotif) {
|
||||
|
||||
const { Circuit } = require('../models/circuit');
|
||||
|
||||
Reference in New Issue
Block a user