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) {
|
||||
|
||||
@@ -73,13 +73,16 @@ module.exports = {
|
||||
SET: 2001,
|
||||
REMOVE_FROM_MYLIST: 2144,
|
||||
REFUSE_REQ: 2145,
|
||||
CANCEL_REQ: 1146,
|
||||
CANCEL_REQ: 2146,
|
||||
DELETE: 2170,
|
||||
ADDADMIN: 2180,
|
||||
REMOVEADMIN: 2185,
|
||||
SENDCOINS_REQ: 2200,
|
||||
SENDCOINS_REQ_SENT: 2205,
|
||||
SENDCOINS_ACCEPT: 2210,
|
||||
SENDCOINS_ACCEPT_SENT: 2212,
|
||||
SENDCOINS_REFUSE: 2220,
|
||||
SENDCOINS_REFUSE_SENT: 2222,
|
||||
},
|
||||
|
||||
REPORT_FILT_RESP: 1,
|
||||
@@ -129,7 +132,7 @@ module.exports = {
|
||||
TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups', 'myhosps'],
|
||||
TABLES_REC_ID: ['skills', 'goods', 'subskills'],
|
||||
|
||||
TABLES_VISU_STAT_IN_HOME: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'mygroups'],
|
||||
TABLES_VISU_STAT_IN_HOME: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'mygroups', 'circuits'],
|
||||
|
||||
TABLES_ADV_NOTIFICATION: ['myskills', 'myhosps', 'mygoods'],
|
||||
TABLES_EVENTS_NOTIFICATION: ['mybachecas'],
|
||||
@@ -138,6 +141,12 @@ module.exports = {
|
||||
|
||||
TABLES_NUM_AS_ID_NUMBER: [ ],
|
||||
|
||||
TABLES_ID_STRING: [
|
||||
'circuits',
|
||||
'accounts',
|
||||
'movements',
|
||||
],
|
||||
|
||||
TABLES_ID_NUMBER: [
|
||||
'permissions',
|
||||
'levels',
|
||||
@@ -155,9 +164,8 @@ module.exports = {
|
||||
'mybachecas',
|
||||
'myhosps',
|
||||
'mygoods',
|
||||
'mygroups',
|
||||
'circuits',
|
||||
'movements'],
|
||||
'mygroups'
|
||||
],
|
||||
TABLES_USER_ID: ['mygroups', 'myskills', 'mybachecas', 'myhosps', 'mygoods'],
|
||||
TABLES_CREATEDBY: ['mygroups', 'circuits'],
|
||||
TABLES_UPDATE_LASTMODIFIED: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'bots', 'mygroups', 'circuits'],
|
||||
@@ -348,6 +356,8 @@ module.exports = {
|
||||
STATUS_REMOVED: 57,
|
||||
STATUS_COINS_ACCEPTED: 60,
|
||||
STATUS_COINS_REFUSED: 61,
|
||||
STATUS_COINS_ACCEPTED_SENT: 62,
|
||||
STATUS_COINS_REFUSED_SENT: 63,
|
||||
},
|
||||
|
||||
TypeNotifs: {
|
||||
@@ -391,6 +401,9 @@ module.exports = {
|
||||
ID_CIRCUIT_SENDCOINSREQ: 512,
|
||||
ID_CIRCUIT_COINS_ACCEPTED: 1024,
|
||||
ID_CIRCUIT_COINS_REFUSED: 2048,
|
||||
ID_CIRCUIT_SENDCOINSREQ_SENT: 4096,
|
||||
ID_CIRCUIT_COINS_ACCEPTED_SENT: 8192,
|
||||
ID_CIRCUIT_COINS_REFUSED_SENT: 16384,
|
||||
|
||||
TYPEDIR_BOOKING: 6,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user