- Transazioni Pendenti (all'Admin compaiono tutte quelle pendenti e con la possibilità di accettarle)

This commit is contained in:
Surya Paolo
2024-09-29 23:26:37 +02:00
parent 5cca1ed2fa
commit 6289a2e2d2
12 changed files with 296 additions and 5 deletions

View File

@@ -84,8 +84,13 @@ router.post('/load', authenticate, async (req, res) => {
data.account = await Account.getAccountByUsernameAndCircuitId(idapp, '', data._id, false, false, '', data.path);
}
let arrrecnotifcoins = null;
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp, shared_consts.LIMIT_NOTIF_FOR_USER, shared_consts.QualiNotifs.OTHERS);
const arrrecnotifcoins = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp, shared_consts.LIMIT_NOTIFCOINS_FOR_USER, shared_consts.QualiNotifs.CIRCUITS);
if (isAdminById(req.user.id)) {
arrrecnotifcoins = await SendNotif.findAllNotifCoinsAllIdAndIdApp(idapp);
} else {
arrrecnotifcoins = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp, shared_consts.LIMIT_NOTIFCOINS_FOR_USER, shared_consts.QualiNotifs.CIRCUITS);
}
/// E' QUIIII !!!!
const useraccounts = await Account.getUserAccounts(idapp, req.user.username);

View File

@@ -1739,6 +1739,7 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
let last_notifs = null;
let last_notifcoins = null;
let usersList = null;
let last_notifcoins_inattesa = null;
// const sall = '0';
// msgs = SendMsg.findAllByUserIdAndIdApp(userId, req.user.username, req.user.idapp);
@@ -1751,7 +1752,12 @@ router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res
last_msgs = SendMsg.findLastGroupByUserIdAndIdApp(userId, req.user.username, idapp);
last_notifs = SendNotif.findLastNotifsByUserIdAndIdApp(req.user.username, idapp, 40);
last_notifcoins_inattesa = SendNotif.findLastNotifCoinsByUserIdAndIdApp(req.user.username, idapp, 200, true);
// Se sono il Gestore, le ricevo tutte quante:
if (User.isAdmin(req.user.perm)) {
last_notifcoins_inattesa = SendNotif.findAllNotifCoinsAllIdAndIdApp(idapp);
} else {
last_notifcoins_inattesa = SendNotif.findLastNotifCoinsByUserIdAndIdApp(req.user.username, idapp, 200, true);
}
last_notifcoins = SendNotif.findLastNotifCoinsByUserIdAndIdApp(req.user.username, idapp, 1, false);
if (req.user) {

View File

@@ -159,7 +159,14 @@ async function getNotif(req, res) {
}
const arrnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIF_FOR_USER, shared_consts.QualiNotifs.OTHERS);
const arrnotifcoins_inattesa = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIFCOINS_IN_ATTESA_FOR_USER, shared_consts.QualiNotifs.CIRCUITS, [{ status: 0 }]);
let arrnotifcoins_inattesa = null;
if (await User.isAdminByUsername(idapp, req.user.username)) {
arrnotifcoins_inattesa = await SendNotif.findAllNotifCoinsAllIdAndIdApp(idapp);
} else {
arrnotifcoins_inattesa = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIFCOINS_IN_ATTESA_FOR_USER, shared_consts.QualiNotifs.CIRCUITS, [{ status: 0 }]);
}
const arrnotifcoins = await SendNotif.findAllNotifByUsernameIdAndIdApp(username, lastdataread, idapp, shared_consts.LIMIT_NOTIFCOINS_FOR_USER, shared_consts.QualiNotifs.CIRCUITS, [{ status: {$ne: 0 }}]);

View File

@@ -1425,6 +1425,10 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
await Circuit.CheckTransazioniCircuiti(false);
} else if (mydata.dbop === 'CorreggiTransazioniCircuiti') {
await Circuit.CheckTransazioniCircuiti(true);
} else if (mydata.dbop === 'RemovePendentTransactions') {
await SendNotif.RemovePendentTransactions(true);
} else if (mydata.dbop === 'RemoveOldNotif90') {
await SendNotif.RemoveOldNotif90(idapp);
} else if (mydata.dbop === 'UpdateCoordProv') {
await Province.setCoordinatesOnDB();
} else if (mydata.dbop === 'insertGeojsonToMongoDB') {