Circuits OK
Accounts Ok Movements OK
This commit is contained in:
@@ -20,7 +20,7 @@ const {ObjectID} = require('mongodb');
|
||||
|
||||
const shared_consts = require('./shared_nodejs');
|
||||
|
||||
const mongoose = require('mongoose').set('debug', process.env.DEBUG);
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
const Subscription = mongoose.model('subscribers');
|
||||
|
||||
const server_constants = require('./server_constants');
|
||||
@@ -855,7 +855,7 @@ module.exports = {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}catch (e) {
|
||||
} catch (e) {
|
||||
console.error('sendNotificationToUser', e.message);
|
||||
}
|
||||
|
||||
@@ -1070,10 +1070,16 @@ module.exports = {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ_SENT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ_SENT;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT_SENT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED_SENT;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED_SENT;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1143,11 +1149,31 @@ module.exports = {
|
||||
let ris = false;
|
||||
let inviato = false;
|
||||
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ || cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT || cmd ===
|
||||
shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ || cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT || cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE ) {
|
||||
ris = await this.sendNotifCircuitByUsername(cmd, idapp, usernameOrig, extrarec.dest, username_action, circuitname, circuit.path, null,
|
||||
let recnotif = null;
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
||||
recnotif = await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REQ_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) {
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
}
|
||||
|
||||
|
||||
if (recnotif)
|
||||
extrarec.notifIdToUpdate = recnotif._id;
|
||||
ris = await this.sendNotifCircuitByUsername(cmd, idapp, usernameOrig, extrarec.dest, username_action, circuitname, circuit.path,
|
||||
null,
|
||||
false, '', extrarec);
|
||||
|
||||
extrarec.notifIdToUpdate = '';
|
||||
|
||||
|
||||
if (ris)
|
||||
inviato = true;
|
||||
// ++Todo: Inviare anche agli Admin ?!
|
||||
@@ -1170,7 +1196,8 @@ module.exports = {
|
||||
|
||||
if (!giainviato && cmd !== shared_consts.CIRCUITCMD.REQ) {
|
||||
// SEND TO THE USER DEST THE NOTIFICATION
|
||||
ris = await this.sendNotifCircuitByUsername(cmd, idapp, usernameOrig, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
ris = await this.sendNotifCircuitByUsername(cmd, idapp, usernameOrig, usernameOrig, username_action, circuitname, circuit.path,
|
||||
null,
|
||||
false, '', extrarec);
|
||||
if (ris)
|
||||
inviato = true;
|
||||
@@ -1581,7 +1608,7 @@ module.exports = {
|
||||
|
||||
myquery = {};
|
||||
|
||||
if (shared_consts.TABLES_ID_NUMBER.includes(params.table)) {
|
||||
if (shared_consts.TABLES_ID_NUMBER.includes(params.table) || shared_consts.TABLES_ID_STRING.includes(params.table)) {
|
||||
myquery = {
|
||||
$match: {
|
||||
$expr: {
|
||||
@@ -1911,19 +1938,19 @@ module.exports = {
|
||||
|
||||
query.push(...myquery);
|
||||
|
||||
/*} else if (params.table === 'circuits') {
|
||||
const qacirc = this.getLookup(
|
||||
{
|
||||
lk_tab: 'accounts',
|
||||
lk_LF: 'circuitId',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'account',
|
||||
}, 0, {
|
||||
'acc': 1,
|
||||
});
|
||||
if (qacirc) query = [...query, ...qacirc];
|
||||
/*} else if (params.table === 'circuits') {
|
||||
const qacirc = this.getLookup(
|
||||
{
|
||||
lk_tab: 'accounts',
|
||||
lk_LF: 'circuitId',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'account',
|
||||
}, 0, {
|
||||
'acc': 1,
|
||||
});
|
||||
if (qacirc) query = [...query, ...qacirc];
|
||||
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
if (newvers) {
|
||||
|
||||
Reference in New Issue
Block a user