- L'utente entra direttamente sul circuito, con fido a zero.
++Abilitazione Fido utente (per admin).
This commit is contained in:
@@ -4,4 +4,5 @@ Lun 06/02 ORE 23:15: Inviate Monete da paoloar77 a surya1977 1 RISTEST [caus
|
|||||||
Lun 06/02 ORE 23:17: Inviate Monete da paoloar77 a surya1977 1 RISTEST [causale: ] [Saldo paoloar77: -52 RISTEST] [Saldo surya1977: 7 RISTEST]
|
Lun 06/02 ORE 23:17: Inviate Monete da paoloar77 a surya1977 1 RISTEST [causale: ] [Saldo paoloar77: -52 RISTEST] [Saldo surya1977: 7 RISTEST]
|
||||||
Dom 12/03 ORE 13:35: Inviate Monete da paoloar77 a 1 RIS [causale: ] [Saldo paoloar77: 3 RIS] [Saldo : 2 RIS]
|
Dom 12/03 ORE 13:35: Inviate Monete da paoloar77 a 1 RIS [causale: ] [Saldo paoloar77: 3 RIS] [Saldo : 2 RIS]
|
||||||
Mer 15/03 ORE 22:15: Inviate Monete da pontiUmani (paoloar77) a paoloar77 1 RIS [causale: ] [Saldo pontiUmani (paoloar77): 1 RIS] [Saldo paoloar77: 4 RIS]
|
Mer 15/03 ORE 22:15: Inviate Monete da pontiUmani (paoloar77) a paoloar77 1 RIS [causale: ] [Saldo pontiUmani (paoloar77): 1 RIS] [Saldo paoloar77: 4 RIS]
|
||||||
Mer 15/03 ORE 22:37: Inviate Monete da pontiUmani (paoloar77) a surya1977 1 RIS [causale: ] [Saldo pontiUmani (paoloar77): 0 RIS] [Saldo surya1977: 1 RIS]
|
Mer 15/03 ORE 22:37: Inviate Monete da pontiUmani (paoloar77) a surya1977 1 RIS [causale: ] [Saldo pontiUmani (paoloar77): 0 RIS] [Saldo surya1977: 1 RIS]
|
||||||
|
Ven 28/04 ORE 01:33: Inviate Monete da surya1977 a risotest 1 RISTEST [causale: ] [Saldo surya1977: 0 RISTEST] [Saldo risotest: 9.5 RISTEST]
|
||||||
@@ -36,29 +36,33 @@
|
|||||||
"FRIEND_UNBLOCKED_TO_ME": "Sei stato riattivato da %s",
|
"FRIEND_UNBLOCKED_TO_ME": "Sei stato riattivato da %s",
|
||||||
"FRIEND_UNBLOCKED": "E' stato riattivato %s da %s.",
|
"FRIEND_UNBLOCKED": "E' stato riattivato %s da %s.",
|
||||||
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
|
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
|
||||||
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍♂️ Accetta Ingresso nel Circuito %s:",
|
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍♂️ Abilita fido a %s nel '%s':",
|
||||||
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍♂️ Accetta Ingresso nel Circuito il gruppo %s:",
|
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍♂️ Abilita fido nel Circuito al gruppo %s:",
|
||||||
"CIRCUIT_REQUEST_TO_ENTER": "%s ha chiesto di entrare nel circuito %s",
|
"CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s ed è in attesa di essere abilitato al Fido (è stato invitato da %s)",
|
||||||
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel circuito %s",
|
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %s",
|
||||||
|
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s",
|
||||||
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
||||||
"CIRCUIT_REQUEST": "Richiesta di entrare nel Circuito %s da parte di %s",
|
"CIRCUIT_REQUEST": "Richiesta di entrare nel %s da parte di %s",
|
||||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del circuito %s da parte di %s",
|
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del %s da parte di %s",
|
||||||
"CIRCUIT_ADDED_ADMIN_YOU": "Sei stato aggiunto come Amministratore del circuito %s da parte di %s",
|
"CIRCUIT_ADDED_ADMIN_YOU": "%s sei stato aggiunto come Amministratore del %s da parte di %s",
|
||||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del circuito %s da parte di %s",
|
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del %s da parte di %s",
|
||||||
"CIRCUIT_REMOVED_ADMIN_YOU": "Ti è stato rimosso l'incarico di Amministratore del circuito %s da parte di %s",
|
"CIRCUIT_REMOVED_ADMIN_YOU": "%s ti è stato rimosso l'incarico di Amministratore del %s da parte di %s",
|
||||||
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il Circuito %s da parte di %s",
|
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il %s da parte di %s",
|
||||||
"CIRCUIT_ELIMINATO": "Il circuito %s è stato eliminato da parte di %s",
|
"CIRCUIT_ELIMINATO": "Il %s è stato eliminato da parte di %s",
|
||||||
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT": "✅ l'utente %s è stato accettato a far parte del Circuito %s (da parte di %s)",
|
"FIDO_IMPOSTATO_ADMINS_CIRCUIT": "✅ l'utente %s è stato abilitato al Fido sul '%s' (da parte di %s)",
|
||||||
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto Collettivo %s è stato accettato a far parte del Circuito %s (da parte di %s)",
|
"FIDO_IMPOSTATO_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto Collettivo %s è stato abilitato al Fido sul '%s' (da parte di %s)",
|
||||||
"CIRCUIT_ACCEPTED": "✅ Sei stato accettato da %s a far parte del Circuito %s.\nApri la APP e clicca in alto a destra sull'icona delle monete, oppure clicca qui: %s",
|
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT": "✅ l'utente %s è stato accettato a far parte del '%s' (da parte di %s)",
|
||||||
"CIRCUIT_ACCEPTED_YOU": "✅ Hai accettato %s a far parte del Circuito %s",
|
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto Collettivo %s è stato accettato a far parte del '%s' (da parte di %s)",
|
||||||
"CIRCUIT_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del Circuito %s. Se pensi sia un'errore, contatta l'amministratore del Circuito.",
|
"CIRCUIT_ACCEPTED": "✅ Sei stato accettato da %s a far parte del %s.\nApri la APP e clicca in alto a destra sull'icona delle monete, oppure clicca qui: %s",
|
||||||
"CIRCUIT_REMOVED": "❌ l'utente %s è stato rimosso del Circuito %s (da parte di %s)",
|
"FIDO_IMPOSTATO": "✅ Sei stato abilitato al fido da %s sul '%s'.",
|
||||||
"CIRCUIT_REFUSED_TO_ME": "All'utente %s gli è stato rifiutato l'accesso a far parte del Circuito %s (da parte di %s).",
|
"CIRCUIT_ACCEPTED_YOU": "✅ Hai accettato %s a far parte del '%s'",
|
||||||
"CIRCUIT_REFUSED_TO_MYGROUP": "Al Conto Collettivo %s gli è stato rifiutato l'accesso a far parte del Circuito %s (da parte di %s).",
|
"CIRCUIT_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del '%s'. Se pensi sia un'errore, contatta l'amministratore del Circuito.",
|
||||||
"CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal Circuito %s",
|
"CIRCUIT_REMOVED": "❌ l'utente %s è stato rimosso del %s (da parte di %s)",
|
||||||
"CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal Circuito %s",
|
"CIRCUIT_REFUSED_TO_ME": "All'utente %s gli è stato rifiutato l'accesso a far parte del '%s' (da parte di %s).",
|
||||||
"CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal Circuito %s (da parte di %s)",
|
"CIRCUIT_REFUSED_TO_MYGROUP": "Al Conto Collettivo %s gli è stato rifiutato l'accesso a far parte del '%s' (da parte di %s).",
|
||||||
|
"CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal '%s'",
|
||||||
|
"CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal '%s'",
|
||||||
|
"CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal '%s' (da parte di %s)",
|
||||||
"CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong>.",
|
"CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong>.",
|
||||||
"COMUNITARIO": "Comunitario",
|
"COMUNITARIO": "Comunitario",
|
||||||
"COLLETTIVO": "Collettivo",
|
"COLLETTIVO": "Collettivo",
|
||||||
@@ -85,9 +89,9 @@
|
|||||||
"CIRCUIT_COINS_ALREADY_PROCESSED": "La richiesta è stata già processata. Stato %s",
|
"CIRCUIT_COINS_ALREADY_PROCESSED": "La richiesta è stata già processata. Stato %s",
|
||||||
"STATUS_SENT": "Inviato",
|
"STATUS_SENT": "Inviato",
|
||||||
"STATUS_REFUSED": "Rifiutato",
|
"STATUS_REFUSED": "Rifiutato",
|
||||||
"SALDO_VARIATO": "[Circuito %s] l'utente %s ha variato il Saldo di %s da %s a %s %s",
|
"SALDO_VARIATO": "[%s] l'utente %s ha variato il Saldo di %s da %s a %s %s",
|
||||||
"FIDOCONCESSO_VARIATO": "[Circuito %s] l'utente %s ha variato il Fido Concesso di %s da %s a %s %s",
|
"FIDOCONCESSO_VARIATO": "[%s] l'utente %s ha variato il Fido Concesso di %s da %s a %s %s",
|
||||||
"QTAMAX_VARIATO": "[Circuito %s] l'utente %s ha variato la quantità massima concessa di %s da %s a %s %s",
|
"QTAMAX_VARIATO": "[%s] l'utente %s ha variato la quantità massima concessa di %s da %s a %s %s",
|
||||||
"SET_FAVORITE": "%s ha messo 'Mi Piace' al tuo post: %s",
|
"SET_FAVORITE": "%s ha messo 'Mi Piace' al tuo post: %s",
|
||||||
"SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s",
|
"SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s",
|
||||||
"EVENT_SEND_MSG": "%s ha mandato un messaggio sull'evento %s: \n%s",
|
"EVENT_SEND_MSG": "%s ha mandato un messaggio sull'evento %s: \n%s",
|
||||||
|
|||||||
@@ -56,12 +56,15 @@ const AccountSchema = new Schema({
|
|||||||
},
|
},
|
||||||
importo_iniziale: {
|
importo_iniziale: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
default: 0,
|
||||||
},
|
},
|
||||||
saldo: {
|
saldo: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
default: 0,
|
||||||
},
|
},
|
||||||
totTransato: {
|
totTransato: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
default: 0,
|
||||||
},
|
},
|
||||||
regulation_ok: {
|
regulation_ok: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -202,7 +205,7 @@ AccountSchema.pre('save', async function (next) {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp, username, circuitId, createifnotexist, groupname = '', contocom = "") {
|
AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp, username, circuitId, createifnotexist, confido, groupname = '', contocom = "") {
|
||||||
const Account = this;
|
const Account = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -263,6 +266,9 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!confido) {
|
||||||
|
myaccount.fidoConcesso = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return await myaccount.save();
|
return await myaccount.save();
|
||||||
}
|
}
|
||||||
@@ -277,14 +283,52 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AccountSchema.statics.createAccount = async function (idapp, username, circuitName, groupname = '', contocom = '') {
|
AccountSchema.statics.isExistAccountByUsernameAndCircuitId = async function (idapp, username, circuitId, groupname = '', contocom = "") {
|
||||||
|
const Account = this;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const { Circuit } = require('../models/circuit');
|
||||||
|
|
||||||
|
if (username === undefined)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let myquery = {
|
||||||
|
idapp,
|
||||||
|
circuitId,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (groupname) {
|
||||||
|
myquery.groupname = groupname;
|
||||||
|
} else if (contocom) {
|
||||||
|
myquery.contocom = contocom;
|
||||||
|
} else {
|
||||||
|
myquery.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mycircuit = await Circuit.getCircuitById(circuitId);
|
||||||
|
|
||||||
|
if (mycircuit) {
|
||||||
|
let myaccount = await Account.findOne(myquery);
|
||||||
|
return !!myaccount
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('error', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
AccountSchema.statics.createAccount = async function (idapp, username, circuitName, confido, groupname = '', contocom = '') {
|
||||||
|
|
||||||
const { Circuit } = require('../models/circuit');
|
const { Circuit } = require('../models/circuit');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mycircuit = await Circuit.findOne({ name: circuitName }, { _id: 1 });
|
mycircuit = await Circuit.findOne({ name: circuitName }, { _id: 1 });
|
||||||
if (mycircuit) {
|
if (mycircuit) {
|
||||||
return await Account.getAccountByUsernameAndCircuitId(idapp, username, mycircuit._id, true, groupname, contocom);
|
return await Account.getAccountByUsernameAndCircuitId(idapp, username, mycircuit._id, true, confido, groupname, contocom);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -337,6 +381,11 @@ AccountSchema.statics.getUserAccounts = async function (idapp, username) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$group:
|
||||||
|
{ _id: "$extrarec.notifIdToUpdate", result: { $first: "$$ROOT" } }
|
||||||
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -349,8 +398,9 @@ AccountSchema.statics.getUserAccounts = async function (idapp, username) {
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
for (const account of ris) {
|
for (const account of ris) {
|
||||||
const pendingtransactions = await SendNotif.getSumPendingTransactions(idapp, username, account.circuit.name);
|
const pendingtransactions = await SendNotif.getSumPendingTransactions(idapp, username, account.circuit.name);
|
||||||
const saldopending = pendingtransactions.reduce((sum, rec) => sum + rec.extrarec.qty, 0);
|
const saldopending = pendingtransactions.reduce((sum, rec) => sum + rec.result.extrarec.qty, 0);
|
||||||
account.saldo -= saldopending;
|
account.saldo -= saldopending;
|
||||||
|
account.totTransato = account.totTransato || 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +453,10 @@ AccountSchema.statics.getGroupAccounts = async function (idapp, groupname) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$group:
|
||||||
|
{ _id: "$extrarec.notifIdToUpdate", result: { $first: "$$ROOT" } }
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -415,7 +469,7 @@ AccountSchema.statics.getGroupAccounts = async function (idapp, groupname) {
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
for (const account of ris) {
|
for (const account of ris) {
|
||||||
const pendingtransactions = await SendNotif.getSumPendingTransactions(idapp, '', account.circuit.name, groupname);
|
const pendingtransactions = await SendNotif.getSumPendingTransactions(idapp, '', account.circuit.name, groupname);
|
||||||
const saldopending = pendingtransactions.reduce((sum, rec) => sum + rec.extrarec.qty, 0);
|
const saldopending = pendingtransactions.reduce((sum, rec) => sum + rec.result.extrarec.qty, 0);
|
||||||
account.saldo -= saldopending;
|
account.saldo -= saldopending;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,6 +526,16 @@ AccountSchema.statics.SetMinMaxPersonali = async function (idapp, valmin, valmax
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AccountSchema.statics.updateFido = async function (idapp, username, circuitId, fido) {
|
||||||
|
|
||||||
|
let paramstoupdate = {
|
||||||
|
fidoConcesso: fido,
|
||||||
|
};
|
||||||
|
const risult = await Account.updateOne({ idapp, username, circuitId }, { $set: paramstoupdate });
|
||||||
|
|
||||||
|
return risult;
|
||||||
|
};
|
||||||
|
|
||||||
AccountSchema.statics.addToPeopleOfMyAccount = async function (idapp, username, circuitId, person_username, perm) {
|
AccountSchema.statics.addToPeopleOfMyAccount = async function (idapp, username, circuitId, person_username, perm) {
|
||||||
|
|
||||||
return await Account.updateOne({ idapp, username, circuitId },
|
return await Account.updateOne({ idapp, username, circuitId },
|
||||||
|
|||||||
@@ -505,59 +505,6 @@ CircuitSchema.statics.deleteCircuit = async function (idapp, usernameOrig, name)
|
|||||||
return await Circuit.findOneAndRemove({ idapp, name });
|
return await Circuit.findOneAndRemove({ idapp, name });
|
||||||
};
|
};
|
||||||
|
|
||||||
CircuitSchema.statics.getUserCircuits = async function (idapp, username) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
let aggr1 = [
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
idapp, username,
|
|
||||||
$or: [
|
|
||||||
{ deleted: { $exists: false } },
|
|
||||||
{ deleted: { $exists: true, $eq: false } }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: 'circuits',
|
|
||||||
localField: 'circuitId',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'circuit',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'$replaceRoot': {
|
|
||||||
'newRoot': {
|
|
||||||
'$mergeObjects': [
|
|
||||||
{
|
|
||||||
'$arrayElemAt': [
|
|
||||||
'$circuit',
|
|
||||||
0,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'$$ROOT',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
$project: {
|
|
||||||
"circuit.name": 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
*/
|
|
||||||
];
|
|
||||||
|
|
||||||
ris = await this.aggregate(aggr1);
|
|
||||||
|
|
||||||
return ris;
|
|
||||||
} catch (e) {
|
|
||||||
console.error('e', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
CircuitSchema.statics.getUsersSingleCircuit = async function (idapp, username, circuitname, circuitId) {
|
CircuitSchema.statics.getUsersSingleCircuit = async function (idapp, username, circuitname, circuitId) {
|
||||||
|
|
||||||
@@ -676,8 +623,16 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
|||||||
if (circuittable) {
|
if (circuittable) {
|
||||||
const myqty = Math.abs(extrarec.qty);
|
const myqty = Math.abs(extrarec.qty);
|
||||||
|
|
||||||
const accountdestTable = await Account.getAccountByUsernameAndCircuitId(idapp, extrarec.dest, circuittable._id, true, extrarec.groupdest, extrarec.contoComDest);
|
const esisteDest = await Account.isExistAccountByUsernameAndCircuitId(idapp, extrarec.dest, circuittable._id, extrarec.groupdest, extrarec.contoComDest);
|
||||||
const accountorigTable = await Account.getAccountByUsernameAndCircuitId(idapp, usernameOrig, circuittable._id, true, extrarec.grouporig, extrarec.contoComOrig);
|
|
||||||
|
if (!esisteDest) {
|
||||||
|
// Fallo entrare anche sul Circuito (oltre ad aver creato l'Account).
|
||||||
|
await this.addCircuitToUser(idapp, usernameOrig, circuitname, false, extrarec.groupdest, extrarec.contoComDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
const accountdestTable = await Account.getAccountByUsernameAndCircuitId(idapp, extrarec.dest, circuittable._id, true, false, extrarec.groupdest, extrarec.contoComDest);
|
||||||
|
const accountorigTable = await Account.getAccountByUsernameAndCircuitId(idapp, usernameOrig, circuittable._id, true, true, extrarec.grouporig, extrarec.contoComOrig);
|
||||||
|
|
||||||
|
|
||||||
const circolantePrec = this.getCircolanteSingolaTransaz(accountorigTable, accountdestTable);
|
const circolantePrec = this.getCircolanteSingolaTransaz(accountorigTable, accountdestTable);
|
||||||
|
|
||||||
@@ -903,6 +858,19 @@ CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, va
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CircuitSchema.statics.AbilitaTuttiCircuiti = async function (idapp) {
|
||||||
|
|
||||||
|
ris = await Circuit.updateMany({ idapp },
|
||||||
|
{
|
||||||
|
$set:
|
||||||
|
{
|
||||||
|
transactionsEnabled: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ris;
|
||||||
|
};
|
||||||
|
|
||||||
// Imposta a tutti i Conti Personali, i seguenti minimi e massimi
|
// Imposta a tutti i Conti Personali, i seguenti minimi e massimi
|
||||||
CircuitSchema.statics.SetDefMinMaxPersonali = async function (idapp, valmin, valmax) {
|
CircuitSchema.statics.SetDefMinMaxPersonali = async function (idapp, valmin, valmax) {
|
||||||
|
|
||||||
@@ -932,14 +900,14 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
|
|||||||
if (!circuit && nomeprovincia) {
|
if (!circuit && nomeprovincia) {
|
||||||
const circ = new Circuit({
|
const circ = new Circuit({
|
||||||
idapp,
|
idapp,
|
||||||
name: 'RIS ' + nomeprovincia,
|
name: 'Circuito RIS ' + nomeprovincia,
|
||||||
path: 'ris' + tools.convertSpaces_ToUScore(nomeprovincia.toLowerCase()),
|
path: 'ris' + tools.convertSpaces_ToUScore(nomeprovincia.toLowerCase()),
|
||||||
strProv: province,
|
strProv: province,
|
||||||
photos: [],
|
photos: [],
|
||||||
admins: [],
|
admins: [],
|
||||||
color: '#ff5500',
|
color: '#ff5500',
|
||||||
deperimento: false,
|
deperimento: false,
|
||||||
transactionsEnabled: false,
|
transactionsEnabled: true, // Abilita cmq il circuito dall'inizio
|
||||||
status: shared_consts.CIRCUIT_STATUS.FASE1_CREAZIONE_GRUPPO,
|
status: shared_consts.CIRCUIT_STATUS.FASE1_CREAZIONE_GRUPPO,
|
||||||
symbol: 'RIS',
|
symbol: 'RIS',
|
||||||
fido_scoperto_default: 100,
|
fido_scoperto_default: 100,
|
||||||
@@ -960,13 +928,13 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
|
|||||||
// nuovo Circuito:
|
// nuovo Circuito:
|
||||||
await User.setCircuitCmd(idapp, useradmin, myrec.name,
|
await User.setCircuitCmd(idapp, useradmin, myrec.name,
|
||||||
shared_consts.CIRCUITCMD.CREATE, true, useradmin, myrec).then((ris) => {
|
shared_consts.CIRCUITCMD.CREATE, true, useradmin, myrec).then((ris) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// aggiungi il creatore al Circuito stesso
|
// aggiungi il creatore al Circuito stesso
|
||||||
await User.setCircuitCmd(idapp, useradmin, myrec.name,
|
await User.setCircuitCmd(idapp, useradmin, myrec.name,
|
||||||
shared_consts.CIRCUITCMD.SET, true, useradmin, myrec).then((ris) => {
|
shared_consts.CIRCUITCMD.SET, true, useradmin, myrec).then((ris) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -981,6 +949,32 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
|
|||||||
return myrec;
|
return myrec;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CircuitSchema.statics.getListCircuitsByUsername = async function (idapp, username, groupname) {
|
||||||
|
|
||||||
|
let mystr = '';
|
||||||
|
const { User } = require('../models/user');
|
||||||
|
const myuser = await User.getUserByUsername(idapp, username);
|
||||||
|
|
||||||
|
const useraccounts = await Account.getUserAccounts(idapp, username);
|
||||||
|
|
||||||
|
for (let account of useraccounts) {
|
||||||
|
if (myuser.profile.mycircuits.find((rec) => (rec.circuitname === account.circuit.name))) {
|
||||||
|
mystr += '\n👉🏻 ' + account.circuit.name + '\n';
|
||||||
|
mystr += '[Saldo: ' + account.saldo + ' RIS, ';
|
||||||
|
mystr += ' Fido: ' + account.fidoConcesso + ' RIS, ';
|
||||||
|
mystr += ' Transato: ' + account.totTransato + ' RIS]';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mystr) {
|
||||||
|
mystr = '[Nessun Circuito]';
|
||||||
|
}
|
||||||
|
|
||||||
|
return mystr;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, valmax) {
|
CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, valmax) {
|
||||||
|
|
||||||
ris = await Circuit.updateMany({ idapp },
|
ris = await Circuit.updateMany({ idapp },
|
||||||
@@ -994,6 +988,27 @@ CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, va
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CircuitSchema.statics.setFido = async function (idapp, username, circuitName, groupname) {
|
||||||
|
|
||||||
|
mycircuit = await Circuit.findOne({ idapp, name: circuitName });
|
||||||
|
if (mycircuit) {
|
||||||
|
const circuitId = mycircuit._id;
|
||||||
|
|
||||||
|
const account = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, true, true, groupname, '');
|
||||||
|
if (account) {
|
||||||
|
let fido = 0;
|
||||||
|
if (groupname)
|
||||||
|
fido = mycircuit.fido_scoperto_default_grp;
|
||||||
|
else
|
||||||
|
fido = mycircuit.fido_scoperto_default;
|
||||||
|
|
||||||
|
return await Account.updateFido(idapp, username, circuitId, fido);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
||||||
|
|
||||||
module.exports = { Circuit };
|
module.exports = { Circuit };
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ const MovementSchema = new Schema({
|
|||||||
},
|
},
|
||||||
causal: {
|
causal: {
|
||||||
type: String,
|
type: String,
|
||||||
|
default: '',
|
||||||
},
|
},
|
||||||
residual: {
|
residual: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
default: 0,
|
||||||
},
|
},
|
||||||
expiringDate: {
|
expiringDate: {
|
||||||
type: Date,
|
type: Date,
|
||||||
@@ -128,7 +130,7 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function (idapp, username
|
|||||||
if (!circuitId) {
|
if (!circuitId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, groupname, contocom);
|
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, true, groupname, contocom);
|
||||||
|
|
||||||
if (myaccount) {
|
if (myaccount) {
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ MyBachecaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
|||||||
MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||||
const MyBacheca = this;
|
const MyBacheca = this;
|
||||||
|
|
||||||
|
|
||||||
let myparsid = {
|
let myparsid = {
|
||||||
'_id': id,
|
'_id': id,
|
||||||
idapp,
|
idapp,
|
||||||
@@ -273,6 +274,20 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
'from': 'mygroups',
|
||||||
|
'localField': 'groupname',
|
||||||
|
'foreignField': 'groupname',
|
||||||
|
'as': 'mygrp',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$unwind: {
|
||||||
|
path: '$mygrp',
|
||||||
|
preserveNullAndEmptyArrays: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||||
},
|
},
|
||||||
@@ -330,7 +345,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
|||||||
try {
|
try {
|
||||||
let numtab = tools.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
let numtab = tools.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||||
|
|
||||||
const objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
let objadd = tools.addNumFavoriteAndBookmarkToQuery(idapp, numtab);
|
||||||
query = [...query, ...objadd.query];
|
query = [...query, ...objadd.query];
|
||||||
|
|
||||||
const toadd = {
|
const toadd = {
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ const ProvinceSchema = new Schema({
|
|||||||
link_grp: {
|
link_grp: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
link_telegram: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
}, { _id : false });
|
}, { _id : false });
|
||||||
|
|
||||||
ProvinceSchema.statics.getRegionByStrProvince = async function(strprovince) {
|
ProvinceSchema.statics.getRegionByStrProvince = async function(strprovince) {
|
||||||
|
|||||||
@@ -171,9 +171,12 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
let newdescr = '';
|
let newdescr = '';
|
||||||
let mydescr = '';
|
let mydescr = '';
|
||||||
let myidrec = '';
|
let myidrec = '';
|
||||||
let sender = recnotif.sender;
|
let sender = recnotif.sender ? recnotif.sender : '';
|
||||||
let tag = '';
|
let tag = '';
|
||||||
|
|
||||||
|
const { Circuit } = require('../models/circuit');
|
||||||
|
const { User } = require('../models/user');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (recnotif.myrectableorig) {
|
if (recnotif.myrectableorig) {
|
||||||
myidrec = recnotif.myrectableorig._id;
|
myidrec = recnotif.myrectableorig._id;
|
||||||
@@ -309,11 +312,17 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
}
|
}
|
||||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS) {
|
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS) {
|
||||||
tag = 'circuit';
|
tag = 'circuit';
|
||||||
|
let strtipocontoDest = '';
|
||||||
|
let strtipocontoOrig = '';
|
||||||
|
let groupOComorig = '';
|
||||||
|
let groupOComdest = '';
|
||||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TAB_MYCIRCUITS, true) + recnotif.paramsObj.path;
|
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TAB_MYCIRCUITS, true) + recnotif.paramsObj.path;
|
||||||
strtipocontoOrig = recnotif.paramsObj.extrarec.contoComOrig ? i18n.__('COMUNITARIO') : i18n.__('COLLETTIVO');
|
if (recnotif.paramsObj.extrarec) {
|
||||||
strtipocontoDest = recnotif.paramsObj.extrarec.contoComDest ? i18n.__('COMUNITARIO') : i18n.__('COLLETTIVO');
|
strtipocontoOrig = recnotif.paramsObj.extrarec.contoComOrig ? i18n.__('COMUNITARIO') : i18n.__('COLLETTIVO');
|
||||||
let groupOComorig = recnotif.paramsObj.extrarec.contoComOrig ? recnotif.paramsObj.extrarec.contoComOrig : recnotif.paramsObj.extrarec.grouporig;
|
strtipocontoDest = recnotif.paramsObj.extrarec.contoComDest ? i18n.__('COMUNITARIO') : i18n.__('COLLETTIVO');
|
||||||
let groupOComdest = recnotif.paramsObj.extrarec.contoComDest ? recnotif.paramsObj.extrarec.contoComDest : recnotif.paramsObj.extrarec.groupdest;
|
groupOComorig = recnotif.paramsObj.extrarec.contoComOrig ? recnotif.paramsObj.extrarec.contoComOrig : recnotif.paramsObj.extrarec.grouporig;
|
||||||
|
groupOComdest = recnotif.paramsObj.extrarec.contoComDest ? recnotif.paramsObj.extrarec.contoComDest : recnotif.paramsObj.extrarec.groupdest;
|
||||||
|
}
|
||||||
let myorig = '';
|
let myorig = '';
|
||||||
let mydest = '';
|
let mydest = '';
|
||||||
let destinatario = '';
|
let destinatario = '';
|
||||||
@@ -338,6 +347,21 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
|
|
||||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_NEW_REC) {
|
if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_NEW_REC) {
|
||||||
newdescr = i18n.__('CIRCUIT_CREATED', sender, recnotif.paramsObj.circuitnameDest);
|
newdescr = i18n.__('CIRCUIT_CREATED', sender, recnotif.paramsObj.circuitnameDest);
|
||||||
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SETFIDO) {
|
||||||
|
if (recnotif.paramsObj.isAdmin) {
|
||||||
|
if (recnotif.extrarec.groupname) {
|
||||||
|
newdescr = i18n.__('FIDO_IMPOSTATO_ADMINS_CIRCUIT_MYGROUP', recnotif.extrarec.groupname, recnotif.paramsObj.circuitnameDest,
|
||||||
|
username_action);
|
||||||
|
} else {
|
||||||
|
newdescr = i18n.__('FIDO_IMPOSTATO_ADMINS_CIRCUIT', sender, recnotif.paramsObj.circuitnameDest,
|
||||||
|
username_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
recnotif.openUrl = '/my/' + sender;
|
||||||
|
} else {
|
||||||
|
newdescr = i18n.__('FIDO_IMPOSTATO', username_action, recnotif.paramsObj.circuitnameDest);
|
||||||
|
}
|
||||||
|
tag = 'setfido';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_ACCEPTED) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_ACCEPTED) {
|
||||||
if (recnotif.paramsObj.isAdmin) {
|
if (recnotif.paramsObj.isAdmin) {
|
||||||
if (recnotif.extrarec.groupname) {
|
if (recnotif.extrarec.groupname) {
|
||||||
@@ -380,12 +404,15 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
}
|
}
|
||||||
tag = 'refcircuit';
|
tag = 'refcircuit';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER) {
|
||||||
|
|
||||||
|
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, sender);
|
||||||
if (recnotif.extrarec.groupname) {
|
if (recnotif.extrarec.groupname) {
|
||||||
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP', recnotif.extrarec.groupname, recnotif.paramsObj.circuitnameDest,
|
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP', recnotif.extrarec.groupname, recnotif.paramsObj.circuitnameDest,
|
||||||
recnotif.paramsObj.singleadmin_username);
|
recnotif.paramsObj.singleadmin_username);
|
||||||
} else {
|
} else {
|
||||||
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, recnotif.paramsObj.circuitnameDest,
|
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, '<strong>' + recnotif.paramsObj.circuitnameDest + '</strong>', aportador_solidario);
|
||||||
recnotif.paramsObj.singleadmin_username);
|
|
||||||
|
newdescr += '\n' + i18n.__('CIRCUIT_WHERE_IS_PRESENT', await Circuit.getListCircuitsByUsername(recnotif.idapp, sender, recnotif.extrarec.groupname));
|
||||||
}
|
}
|
||||||
tag = 'reqcircuits';
|
tag = 'reqcircuits';
|
||||||
|
|
||||||
@@ -394,7 +421,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
tag = 'deletecircuit';
|
tag = 'deletecircuit';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_ADDED_ADMIN) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_ADDED_ADMIN) {
|
||||||
if (sender === recnotif.paramsObj.usernameDest) {
|
if (sender === recnotif.paramsObj.usernameDest) {
|
||||||
newdescr = i18n.__('CIRCUIT_ADDED_ADMIN_YOU', recnotif.paramsObj.circuitnameDest, username_action);
|
newdescr = i18n.__('CIRCUIT_ADDED_ADMIN_YOU', recnotif.paramsObj.usernameDest, recnotif.paramsObj.circuitnameDest, username_action);
|
||||||
} else {
|
} else {
|
||||||
newdescr = i18n.__('CIRCUIT_ADDED_ADMIN', sender, recnotif.paramsObj.circuitnameDest, username_action);
|
newdescr = i18n.__('CIRCUIT_ADDED_ADMIN', sender, recnotif.paramsObj.circuitnameDest, username_action);
|
||||||
recnotif.openUrl = '/my/' + sender;
|
recnotif.openUrl = '/my/' + sender;
|
||||||
@@ -402,7 +429,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
tag = 'addadmingrp';
|
tag = 'addadmingrp';
|
||||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN) {
|
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN) {
|
||||||
if (sender === recnotif.paramsObj.usernameDest) {
|
if (sender === recnotif.paramsObj.usernameDest) {
|
||||||
newdescr = i18n.__('CIRCUIT_REMOVED_ADMIN_YOU', recnotif.paramsObj.circuitnameDest, username_action);
|
newdescr = i18n.__('CIRCUIT_REMOVED_ADMIN_YOU', recnotif.paramsObj.usernameDest, recnotif.paramsObj.circuitnameDest, username_action);
|
||||||
} else {
|
} else {
|
||||||
newdescr = i18n.__('CIRCUIT_REMOVED_ADMIN', sender, recnotif.paramsObj.circuitnameDest, username_action);
|
newdescr = i18n.__('CIRCUIT_REMOVED_ADMIN', sender, recnotif.paramsObj.circuitnameDest, username_action);
|
||||||
recnotif.openUrl = '/my/' + sender;
|
recnotif.openUrl = '/my/' + sender;
|
||||||
@@ -614,10 +641,10 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
|
|||||||
let typeidsearch = 0;
|
let typeidsearch = 0;
|
||||||
let dest = '';
|
let dest = '';
|
||||||
|
|
||||||
let sender = myrecnotif.sender;
|
let sender = myrecnotif.sender ? myrecnotif.sender : '';
|
||||||
let newdest = myrecnotif.dest;
|
let newdest = myrecnotif.dest ? myrecnotif.dest : '';
|
||||||
let sendergroup = myrecnotif.sendergroup;
|
let sendergroup = myrecnotif.sendergroup ? myrecnotif.sendergroup : '';
|
||||||
let newdestgroup = myrecnotif.destgroup;
|
let newdestgroup = myrecnotif.destgroup ? myrecnotif.destgroup : '';
|
||||||
|
|
||||||
// Controllare se devo modificare un Notif già esistente !
|
// Controllare se devo modificare un Notif già esistente !
|
||||||
if (myrecnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
|
if (myrecnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
|
||||||
|
|||||||
@@ -1530,7 +1530,7 @@ UserSchema.statics.getUserById = function (idapp, id) {
|
|||||||
UserSchema.statics.getUserByUsername = function (idapp, username) {
|
UserSchema.statics.getUserByUsername = function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
return User.findne({
|
return User.findOne({
|
||||||
idapp,
|
idapp,
|
||||||
username,
|
username,
|
||||||
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||||
@@ -1900,13 +1900,65 @@ UserSchema.statics.removeFromMyGroups = async function (
|
|||||||
return await User.updateOne({ idapp, username },
|
return await User.updateOne({ idapp, username },
|
||||||
{ $pull: { 'profile.mygroups': { groupname: { $in: [groupnameDest] } } } });
|
{ $pull: { 'profile.mygroups': { groupname: { $in: [groupnameDest] } } } });
|
||||||
};
|
};
|
||||||
// Rimuovo il Gruppo
|
|
||||||
|
// Rimuovo il Circuito
|
||||||
UserSchema.statics.removeFromCircuits = async function (idapp, username, circuitname) {
|
UserSchema.statics.removeFromCircuits = async function (idapp, username, circuitname) {
|
||||||
return await User.updateOne({ idapp, username },
|
|
||||||
|
// Elimina la richiesta (se esiste):
|
||||||
|
update = { $pull: { req_users: { username: { $in: [username] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
|
return await User.updateOne({ idapp, username },
|
||||||
{ $pull: { 'profile.mycircuits': { circuitname: { $in: [circuitname] } } } });
|
{ $pull: { 'profile.mycircuits': { circuitname: { $in: [circuitname] } } } });
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Aggiungo il Circuito
|
||||||
|
UserSchema.statics.addCircuitToUser = async function (idapp, usernameOrig, circuitname, confido, groupname, contocom) {
|
||||||
|
|
||||||
|
let ris = null;
|
||||||
|
|
||||||
|
if (groupname) {
|
||||||
|
|
||||||
|
ris = await MyGroup.addCircuitFromGroup(idapp, groupname, circuitname);
|
||||||
|
|
||||||
|
// Elimina la richiesta:
|
||||||
|
update = { $pull: { req_groups: { groupname: { $in: [groupname] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
|
// Elimina eventualmente se era bloccato:
|
||||||
|
update = { $pull: { refused_groups: { groupname: { $in: [groupname] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let update = {
|
||||||
|
$push: {
|
||||||
|
'profile.mycircuits': {
|
||||||
|
circuitname,
|
||||||
|
date: new Date(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
||||||
|
|
||||||
|
if (confido) {
|
||||||
|
// Elimina la richiesta:
|
||||||
|
update = { $pull: { req_users: { username: { $in: [usernameOrig] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Elimina eventualmente se era bloccato:
|
||||||
|
update = { $pull: { refused_users: { username: { $in: [usernameOrig] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await Account.createAccount(idapp, usernameOrig, circuitname, confido, groupname, contocom);
|
||||||
|
|
||||||
|
return ris;
|
||||||
|
};
|
||||||
|
|
||||||
// Rimuovo il Gruppo per Tutti gli Utenti
|
// Rimuovo il Gruppo per Tutti gli Utenti
|
||||||
UserSchema.statics.removeAllUsersFromMyGroups = async function (idapp, groupnameDest) {
|
UserSchema.statics.removeAllUsersFromMyGroups = async function (idapp, groupnameDest) {
|
||||||
return await User.updateMany({ idapp },
|
return await User.updateMany({ idapp },
|
||||||
@@ -2521,7 +2573,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
const mycirc = await Circuit.findOne({ idapp, name: circuitname });
|
const mycirc = await Circuit.findOne({ idapp, name: circuitname });
|
||||||
if (mycirc) {
|
if (mycirc) {
|
||||||
// Il Conto Comunitario prende il nome del circuito !
|
// Il Conto Comunitario prende il nome del circuito !
|
||||||
await Account.createAccount(idapp, '', circuitname, '', mycirc.path);
|
await Account.createAccount(idapp, '', circuitname, true, '', mycirc.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmd === shared_consts.CIRCUITCMD.SET) {
|
} else if (cmd === shared_consts.CIRCUITCMD.SET) {
|
||||||
@@ -2529,18 +2581,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
const foundIfCircuitInGroup = await MyGroup.ifCircuitAlreadyInGroup(idapp, groupname, circuitname);
|
const foundIfCircuitInGroup = await MyGroup.ifCircuitAlreadyInGroup(idapp, groupname, circuitname);
|
||||||
|
|
||||||
if (!foundIfCircuitInGroup) {
|
if (!foundIfCircuitInGroup) {
|
||||||
ris = await MyGroup.addCircuitFromGroup(idapp, groupname, circuitname);
|
ris = await this.addCircuitToUser(idapp, usernameOrig, circuitname, true, groupname);
|
||||||
|
|
||||||
// Elimina la richiesta:
|
|
||||||
update = { $pull: { req_groups: { groupname: { $in: [groupname] } } } };
|
|
||||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
|
||||||
|
|
||||||
// Elimina eventualmente se era bloccato:
|
|
||||||
update = { $pull: { refused_groups: { groupname: { $in: [groupname] } } } };
|
|
||||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
|
||||||
|
|
||||||
await Account.createAccount(idapp, '', circuitname, groupname);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ris = false;
|
ris = false;
|
||||||
@@ -2552,7 +2593,6 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, value, true, username_action, extrarec);
|
tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, value, true, username_action, extrarec);
|
||||||
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const foundIfAlreadyCircuit = await this.ifAlreadyInCircuit(idapp, usernameOrig, circuitname);
|
const foundIfAlreadyCircuit = await this.ifAlreadyInCircuit(idapp, usernameOrig, circuitname);
|
||||||
|
|
||||||
@@ -2567,10 +2607,6 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
};
|
};
|
||||||
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
||||||
|
|
||||||
// Elimina la richiesta:
|
|
||||||
update = { $pull: { req_users: { username: { $in: [usernameOrig] } } } };
|
|
||||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
|
||||||
|
|
||||||
// Elimina eventualmente se era bloccato:
|
// Elimina eventualmente se era bloccato:
|
||||||
update = { $pull: { refused_users: { username: { $in: [usernameOrig] } } } };
|
update = { $pull: { refused_users: { username: { $in: [usernameOrig] } } } };
|
||||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
@@ -2589,6 +2625,22 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (cmd === shared_consts.CIRCUITCMD.SETFIDO) {
|
||||||
|
|
||||||
|
ris = await Circuit.setFido(idapp, usernameOrig, circuitname, groupname);
|
||||||
|
|
||||||
|
// Elimina la richiesta:
|
||||||
|
update = { $pull: { req_users: { username: { $in: [usernameOrig] } } } };
|
||||||
|
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
|
await Circuit.updateData(idapp, circuitname)
|
||||||
|
if (ris) {
|
||||||
|
// Invia una notifica alla persona e agli Admin
|
||||||
|
tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, value, true, username_action, extrarec);
|
||||||
|
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (cmd === shared_consts.CIRCUITCMD.REQ) {
|
} else if (cmd === shared_consts.CIRCUITCMD.REQ) {
|
||||||
|
|
||||||
if (groupname) {
|
if (groupname) {
|
||||||
@@ -2628,7 +2680,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Aggiungo la richiesta di Gruppo a me
|
// Aggiungo la richiesta di Circuito a me
|
||||||
const foundIfAlreadyAskCircuit = await Circuit.findOne({
|
const foundIfAlreadyAskCircuit = await Circuit.findOne({
|
||||||
idapp,
|
idapp,
|
||||||
name: circuitname,
|
name: circuitname,
|
||||||
@@ -2638,6 +2690,9 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
// Aggiungi intanto l'utente al Circuito (senza fido)
|
||||||
|
ris = await this.addCircuitToUser(idapp, usernameOrig, circuitname, false);
|
||||||
|
|
||||||
if (!foundIfAlreadyAskCircuit) {
|
if (!foundIfAlreadyAskCircuit) {
|
||||||
update = {
|
update = {
|
||||||
$push: {
|
$push: {
|
||||||
@@ -2647,6 +2702,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
// Aggiungi la richiesta per ottenere il fido
|
||||||
ris = await Circuit.updateOne({ idapp, name: circuitname }, update);
|
ris = await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,124 +1,124 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
list: [
|
list: [
|
||||||
{_id: 1, reg: 'SIC', prov: 'AG', descr: 'Agrigento', link_grp: 'https://t.me/c/1614195634/562?thread=553'},
|
{_id: 1, reg: 'SIC', prov: 'AG', descr: 'Agrigento', link_grp: 'https://t.me/c/1614195634/562?thread=553', link_telegram: ''},
|
||||||
{_id: 2, reg: 'PIE', prov: 'AL', descr: 'Alessandria', link_grp: 'https://t.me/c/1614195634/513?thread=504'},
|
{_id: 2, reg: 'PIE', prov: 'AL', descr: 'Alessandria', link_grp: 'https://t.me/c/1614195634/513?thread=504', link_telegram: ''},
|
||||||
{_id: 3, reg: 'MAR', prov: 'AN', descr: 'Ancona', link_grp: 'https://t.me/c/1614195634/450?thread=446'},
|
{_id: 3, reg: 'MAR', prov: 'AN', descr: 'Ancona', link_grp: 'https://t.me/c/1614195634/450?thread=446', link_telegram: ''},
|
||||||
{_id: 4, reg: 'VDA', prov: 'AO', descr: 'Aosta', link_grp: 'https://t.me/c/1614195634/521?thread=520'},
|
{_id: 4, reg: 'VDA', prov: 'AO', descr: 'Aosta', link_grp: 'https://t.me/c/1614195634/521?thread=520', link_telegram: ''},
|
||||||
{_id: 5, reg: 'TOS', prov: 'AR', descr: 'Arezzo', link_grp: 'https://t.me/c/1614195634/583?thread=572'},
|
{_id: 5, reg: 'TOS', prov: 'AR', descr: 'Arezzo', link_grp: 'https://t.me/c/1614195634/583?thread=572', link_telegram: ''},
|
||||||
{_id: 6, reg: 'MAR', prov: 'AP', descr: 'Ascoli Piceno', link_grp: 'https://t.me/c/1614195634/451?thread=447'},
|
{_id: 6, reg: 'MAR', prov: 'AP', descr: 'Ascoli Piceno', link_grp: 'https://t.me/c/1614195634/451?thread=447', link_telegram: ''},
|
||||||
{_id: 7, reg: 'PIE', prov: 'AT', descr: 'Asti', link_grp: 'https://t.me/c/1614195634/514?thread=505'},
|
{_id: 7, reg: 'PIE', prov: 'AT', descr: 'Asti', link_grp: 'https://t.me/c/1614195634/514?thread=505', link_telegram: ''},
|
||||||
{_id: 8, reg: 'CAM', prov: 'AV', descr: 'Avellino', link_grp: 'https://t.me/c/1614195634/413?thread=409'},
|
{_id: 8, reg: 'CAM', prov: 'AV', descr: 'Avellino', link_grp: 'https://t.me/c/1614195634/413?thread=409', link_telegram: ''},
|
||||||
{_id: 9, reg: 'PUG', prov: 'BA', descr: 'Bari', link_grp: 'https://t.me/c/1614195634/534?thread=528'},
|
{_id: 9, reg: 'PUG', prov: 'BA', descr: 'Bari', link_grp: 'https://t.me/c/1614195634/534?thread=528', link_telegram: ''},
|
||||||
{_id: 10, reg: 'PUG', prov: 'BT', descr: 'Barletta-Andria-Trani', link_grp: 'https://t.me/c/1614195634/535?thread=529'},
|
{_id: 10, reg: 'PUG', prov: 'BT', descr: 'Barletta-Andria-Trani', link_grp: 'https://t.me/c/1614195634/535?thread=529', link_telegram: ''},
|
||||||
{_id: 11, reg: 'VEN', prov: 'BL', descr: 'Belluno', link_grp: 'https://t.me/c/1614195634/608?thread=599'},
|
{_id: 11, reg: 'VEN', prov: 'BL', descr: 'Belluno', link_grp: 'https://t.me/c/1614195634/608?thread=599', link_telegram: ''},
|
||||||
{_id: 12, reg: 'CAM', prov: 'BN', descr: 'Benevento', link_grp: 'https://t.me/c/1614195634/415?thread=411'},
|
{_id: 12, reg: 'CAM', prov: 'BN', descr: 'Benevento', link_grp: 'https://t.me/c/1614195634/415?thread=411', link_telegram: ''},
|
||||||
{_id: 13, reg: 'LOM', prov: 'BG', descr: 'Bergamo', link_grp: 'https://t.me/c/1614195634/491?thread=477'},
|
{_id: 13, reg: 'LOM', prov: 'BG', descr: 'Bergamo', link_grp: 'https://t.me/c/1614195634/491?thread=477', link_telegram: ''},
|
||||||
{_id: 14, reg: 'PIE', prov: 'BI', descr: 'Biella', link_grp: 'https://t.me/c/1614195634/515?thread=506'},
|
{_id: 14, reg: 'PIE', prov: 'BI', descr: 'Biella', link_grp: 'https://t.me/c/1614195634/515?thread=506', link_telegram: ''},
|
||||||
{_id: 15, reg: 'EMR', prov: 'BO', descr: 'Bologna', link_grp: 'https://t.me/c/1614195634/428?thread=419'},
|
{_id: 15, reg: 'EMR', prov: 'BO', descr: 'Bologna', link_grp: 'https://t.me/c/1614195634/428?thread=419', link_telegram: ''},
|
||||||
{_id: 16, reg: 'TAA', prov: 'BZ', descr: 'Bolzano', link_grp: 'https://t.me/c/1614195634/596?thread=594'},
|
{_id: 16, reg: 'TAA', prov: 'BZ', descr: 'Bolzano', link_grp: 'https://t.me/c/1614195634/596?thread=594', link_telegram: ''},
|
||||||
{_id: 17, reg: 'LOM', prov: 'BS', descr: 'Brescia', link_grp: 'https://t.me/c/1614195634/490?thread=478'},
|
{_id: 17, reg: 'LOM', prov: 'BS', descr: 'Brescia', link_grp: 'https://t.me/c/1614195634/490?thread=478', link_telegram: ''},
|
||||||
{_id: 18, reg: 'PUG', prov: 'BR', descr: 'Brindisi', link_grp: 'https://t.me/c/1614195634/536?thread=530'},
|
{_id: 18, reg: 'PUG', prov: 'BR', descr: 'Brindisi', link_grp: 'https://t.me/c/1614195634/536?thread=530', link_telegram: ''},
|
||||||
{_id: 19, reg: 'SAR', prov: 'CA', descr: 'Cagliari', link_grp: 'https://t.me/c/1614195634/546?thread=541'},
|
{_id: 19, reg: 'SAR', prov: 'CA', descr: 'Cagliari', link_grp: 'https://t.me/c/1614195634/546?thread=541', link_telegram: ''},
|
||||||
{_id: 20, reg: 'SIC', prov: 'CL', descr: 'Caltanissetta', link_grp: 'https://t.me/c/1614195634/563?thread=554'},
|
{_id: 20, reg: 'SIC', prov: 'CL', descr: 'Caltanissetta', link_grp: 'https://t.me/c/1614195634/563?thread=554', link_telegram: ''},
|
||||||
{_id: 21, reg: 'MOL', prov: 'CB', descr: 'Campobasso', link_grp: 'https://t.me/c/1614195634/398?thread=396'},
|
{_id: 21, reg: 'MOL', prov: 'CB', descr: 'Campobasso', link_grp: 'https://t.me/c/1614195634/398?thread=396', link_telegram: ''},
|
||||||
{_id: 22, reg: 'SAR', prov: 'CI', descr: 'Carbonia-Iglesias', link_grp: ''},
|
{_id: 22, reg: 'SAR', prov: 'CI', descr: 'Carbonia-Iglesias', link_grp: '', link_telegram: ''},
|
||||||
{_id: 23, reg: 'CAM', prov: 'CE', descr: 'Caserta', link_grp: 'https://t.me/c/1614195634/414?thread=410'},
|
{_id: 23, reg: 'CAM', prov: 'CE', descr: 'Caserta', link_grp: 'https://t.me/c/1614195634/414?thread=410', link_telegram: ''},
|
||||||
{_id: 24, reg: 'SIC', prov: 'CT', descr: 'Catania', link_grp: 'https://t.me/c/1614195634/564?thread=555'},
|
{_id: 24, reg: 'SIC', prov: 'CT', descr: 'Catania', link_grp: 'https://t.me/c/1614195634/564?thread=555', link_telegram: ''},
|
||||||
{_id: 25, reg: 'CAL', prov: 'CZ', descr: 'Catanzaro', link_grp: 'https://t.me/c/1614195634/378?thread=377'},
|
{_id: 25, reg: 'CAL', prov: 'CZ', descr: 'Catanzaro', link_grp: 'https://t.me/c/1614195634/378?thread=377', link_telegram: ''},
|
||||||
{_id: 26, reg: 'ABR', prov: 'CH', descr: 'Chieti', link_grp: 'https://t.me/c/1614195634/366?thread=365'},
|
{_id: 26, reg: 'ABR', prov: 'CH', descr: 'Chieti', link_grp: 'https://t.me/c/1614195634/366?thread=365', link_telegram: ''},
|
||||||
{_id: 27, reg: 'LOM', prov: 'CO', descr: 'Como', link_grp: 'https://t.me/c/1614195634/492?thread=479'},
|
{_id: 27, reg: 'LOM', prov: 'CO', descr: 'Como', link_grp: 'https://t.me/c/1614195634/492?thread=479', link_telegram: ''},
|
||||||
{_id: 28, reg: 'CAL', prov: 'CS', descr: 'Cosenza', link_grp: 'https://t.me/c/1614195634/381?thread=379'},
|
{_id: 28, reg: 'CAL', prov: 'CS', descr: 'Cosenza', link_grp: 'https://t.me/c/1614195634/381?thread=379', link_telegram: ''},
|
||||||
{_id: 29, reg: 'LOM', prov: 'CR', descr: 'Cremona', link_grp: 'https://t.me/c/1614195634/493?thread=480'},
|
{_id: 29, reg: 'LOM', prov: 'CR', descr: 'Cremona', link_grp: 'https://t.me/c/1614195634/493?thread=480', link_telegram: ''},
|
||||||
{_id: 30, reg: 'CAL', prov: 'KR', descr: 'Crotone', link_grp: 'https://t.me/c/1614195634/382?thread=380'},
|
{_id: 30, reg: 'CAL', prov: 'KR', descr: 'Crotone', link_grp: 'https://t.me/c/1614195634/382?thread=380', link_telegram: ''},
|
||||||
{_id: 31, reg: 'PIE', prov: 'CN', descr: 'Cuneo', link_grp: 'https://t.me/c/1614195634/516?thread=507'},
|
{_id: 31, reg: 'PIE', prov: 'CN', descr: 'Cuneo', link_grp: 'https://t.me/c/1614195634/516?thread=507', link_telegram: ''},
|
||||||
{_id: 32, reg: 'SIC', prov: 'EN', descr: 'Enna', link_grp: 'https://t.me/c/1614195634/565?thread=556'},
|
{_id: 32, reg: 'SIC', prov: 'EN', descr: 'Enna', link_grp: 'https://t.me/c/1614195634/565?thread=556', link_telegram: ''},
|
||||||
{_id: 33, reg: 'MAR', prov: 'FM', descr: 'Fermo', link_grp: 'https://t.me/c/1614195634/453?thread=448'},
|
{_id: 33, reg: 'MAR', prov: 'FM', descr: 'Fermo', link_grp: 'https://t.me/c/1614195634/453?thread=448', link_telegram: ''},
|
||||||
{_id: 34, reg: 'EMR', prov: 'FE', descr: 'Ferrara', link_grp: 'https://t.me/c/1614195634/429?thread=420'},
|
{_id: 34, reg: 'EMR', prov: 'FE', descr: 'Ferrara', link_grp: 'https://t.me/c/1614195634/429?thread=420', link_telegram: ''},
|
||||||
{_id: 35, reg: 'TOS', prov: 'FI', descr: 'Firenze', link_grp: 'https://t.me/c/1614195634/584?thread=573'},
|
{_id: 35, reg: 'TOS', prov: 'FI', descr: 'Firenze', link_grp: 'https://t.me/c/1614195634/584?thread=573', link_telegram: ''},
|
||||||
{_id: 36, reg: 'PUG', prov: 'FG', descr: 'Foggia', link_grp: 'https://t.me/c/1614195634/537?thread=531'},
|
{_id: 36, reg: 'PUG', prov: 'FG', descr: 'Foggia', link_grp: 'https://t.me/c/1614195634/537?thread=531', link_telegram: ''},
|
||||||
{_id: 37, reg: 'EMR', prov: 'FC', descr: 'Forli-Cesena', link_grp: 'https://t.me/c/1614195634/430?thread=421'},
|
{_id: 37, reg: 'EMR', prov: 'FC', descr: 'Forli-Cesena', link_grp: 'https://t.me/c/1614195634/430?thread=421', link_telegram: ''},
|
||||||
{_id: 38, reg: 'LAZ', prov: 'FR', descr: 'Frosinone', link_grp: 'https://t.me/c/1614195634/48?thread=44'},
|
{_id: 38, reg: 'LAZ', prov: 'FR', descr: 'Frosinone', link_grp: 'https://t.me/c/1614195634/48?thread=44', link_telegram: ''},
|
||||||
{_id: 39, reg: 'LIG', prov: 'GE', descr: 'Genova', link_grp: 'https://t.me/c/1614195634/392?thread=388'},
|
{_id: 39, reg: 'LIG', prov: 'GE', descr: 'Genova', link_grp: 'https://t.me/c/1614195634/392?thread=388', link_telegram: ''},
|
||||||
{_id: 40, reg: 'FVG', prov: 'GO', descr: 'Gorizia', link_grp: 'https://t.me/c/1614195634/469?thread=465'},
|
{_id: 40, reg: 'FVG', prov: 'GO', descr: 'Gorizia', link_grp: 'https://t.me/c/1614195634/469?thread=465', link_telegram: ''},
|
||||||
{_id: 41, reg: 'TOS', prov: 'GR', descr: 'Grosseto', link_grp: 'https://t.me/c/1614195634/585?thread=574'},
|
{_id: 41, reg: 'TOS', prov: 'GR', descr: 'Grosseto', link_grp: 'https://t.me/c/1614195634/585?thread=574', link_telegram: ''},
|
||||||
{_id: 42, reg: 'LIG', prov: 'IM', descr: 'Imperia', link_grp: 'https://t.me/c/1614195634/393?thread=389'},
|
{_id: 42, reg: 'LIG', prov: 'IM', descr: 'Imperia', link_grp: 'https://t.me/c/1614195634/393?thread=389', link_telegram: ''},
|
||||||
{_id: 43, reg: 'MOL', prov: 'IS', descr: 'Isernia', link_grp: 'https://t.me/c/1614195634/399?thread=397'},
|
{_id: 43, reg: 'MOL', prov: 'IS', descr: 'Isernia', link_grp: 'https://t.me/c/1614195634/399?thread=397', link_telegram: ''},
|
||||||
{_id: 44, reg: 'LIG', prov: 'SP', descr: 'La Spezia', link_grp: 'https://t.me/c/1614195634/394?thread=390'},
|
{_id: 44, reg: 'LIG', prov: 'SP', descr: 'La Spezia', link_grp: 'https://t.me/c/1614195634/394?thread=390', link_telegram: ''},
|
||||||
{_id: 45, reg: 'ABR', prov: 'AQ', descr: 'L\'Aquila', link_grp: 'https://t.me/c/1614195634/364?thread=363'},
|
{_id: 45, reg: 'ABR', prov: 'AQ', descr: 'L\'Aquila', link_grp: 'https://t.me/c/1614195634/364?thread=363', link_telegram: ''},
|
||||||
{_id: 46, reg: 'LAZ', prov: 'LT', descr: 'Latina', link_grp: 'https://t.me/c/1614195634/60?thread=46'},
|
{_id: 46, reg: 'LAZ', prov: 'LT', descr: 'Latina', link_grp: 'https://t.me/c/1614195634/60?thread=46', link_telegram: ''},
|
||||||
{_id: 47, reg: 'PUG', prov: 'LE', descr: 'Lecce', link_grp: 'https://t.me/c/1614195634/538?thread=532'},
|
{_id: 47, reg: 'PUG', prov: 'LE', descr: 'Lecce', link_grp: 'https://t.me/c/1614195634/538?thread=532', link_telegram: ''},
|
||||||
{_id: 48, reg: 'LOM', prov: 'LC', descr: 'Lecco', link_grp: 'https://t.me/c/1614195634/494?thread=482'},
|
{_id: 48, reg: 'LOM', prov: 'LC', descr: 'Lecco', link_grp: 'https://t.me/c/1614195634/494?thread=482', link_telegram: ''},
|
||||||
{_id: 49, reg: 'TOS', prov: 'LI', descr: 'Livorno', link_grp: 'https://t.me/c/1614195634/586?thread=575'},
|
{_id: 49, reg: 'TOS', prov: 'LI', descr: 'Livorno', link_grp: 'https://t.me/c/1614195634/586?thread=575', link_telegram: ''},
|
||||||
{_id: 50, reg: 'LOM', prov: 'LO', descr: 'Lodi', link_grp: 'https://t.me/c/1614195634/495?thread=483'},
|
{_id: 50, reg: 'LOM', prov: 'LO', descr: 'Lodi', link_grp: 'https://t.me/c/1614195634/495?thread=483', link_telegram: ''},
|
||||||
{_id: 51, reg: 'TOS', prov: 'LU', descr: 'Lucca', link_grp: 'https://t.me/c/1614195634/587?thread=576'},
|
{_id: 51, reg: 'TOS', prov: 'LU', descr: 'Lucca', link_grp: 'https://t.me/c/1614195634/587?thread=576', link_telegram: ''},
|
||||||
{_id: 52, reg: 'MAR', prov: 'MC', descr: 'Macerata', link_grp: 'https://t.me/c/1614195634/300?thread=162'},
|
{_id: 52, reg: 'MAR', prov: 'MC', descr: 'Macerata', link_grp: 'https://t.me/c/1614195634/300?thread=162', link_telegram: ''},
|
||||||
{_id: 53, reg: 'LOM', prov: 'MN', descr: 'Mantova', link_grp: 'https://t.me/c/1614195634/497?thread=484'},
|
{_id: 53, reg: 'LOM', prov: 'MN', descr: 'Mantova', link_grp: 'https://t.me/c/1614195634/497?thread=484', link_telegram: ''},
|
||||||
{_id: 54, reg: 'TOS', prov: 'MS', descr: 'Massa-Carrara', link_grp: 'https://t.me/c/1614195634/588?thread=577'},
|
{_id: 54, reg: 'TOS', prov: 'MS', descr: 'Massa-Carrara', link_grp: 'https://t.me/c/1614195634/588?thread=577', link_telegram: ''},
|
||||||
{_id: 55, reg: 'BAS', prov: 'MT', descr: 'Matera', link_grp: 'https://t.me/c/1614195634/374?thread=373'},
|
{_id: 55, reg: 'BAS', prov: 'MT', descr: 'Matera', link_grp: 'https://t.me/c/1614195634/374?thread=373', link_telegram: ''},
|
||||||
{_id: 56, reg: 'SIC', prov: 'ME', descr: 'Messina', link_grp: 'https://t.me/c/1614195634/566?thread=557'},
|
{_id: 56, reg: 'SIC', prov: 'ME', descr: 'Messina', link_grp: 'https://t.me/c/1614195634/566?thread=557', link_telegram: ''},
|
||||||
{_id: 57, reg: 'LOM', prov: 'MI', descr: 'Milano', link_grp: 'https://t.me/c/1614195634/214?thread=173'},
|
{_id: 57, reg: 'LOM', prov: 'MI', descr: 'Milano', link_grp: 'https://t.me/c/1614195634/214?thread=173', link_telegram: ''},
|
||||||
{_id: 58, reg: 'EMR', prov: 'MO', descr: 'Modena', link_grp: 'https://t.me/c/1614195634/431?thread=422'},
|
{_id: 58, reg: 'EMR', prov: 'MO', descr: 'Modena', link_grp: 'https://t.me/c/1614195634/431?thread=422', link_telegram: ''},
|
||||||
{_id: 59, reg: 'LOM', prov: 'MB', descr: 'Monza e della Brianza', link_grp: 'https://t.me/c/1614195634/498?thread=485'},
|
{_id: 59, reg: 'LOM', prov: 'MB', descr: 'Monza e della Brianza', link_grp: 'https://t.me/c/1614195634/498?thread=485', link_telegram: ''},
|
||||||
{_id: 60, reg: 'CAM', prov: 'NA', descr: 'Napoli', link_grp: 'https://t.me/c/1614195634/407?thread=406'},
|
{_id: 60, reg: 'CAM', prov: 'NA', descr: 'Napoli', link_grp: 'https://t.me/c/1614195634/407?thread=406', link_telegram: ''},
|
||||||
{_id: 61, reg: 'PIE', prov: 'NO', descr: 'Novara', link_grp: 'https://t.me/c/1614195634/517?thread=508'},
|
{_id: 61, reg: 'PIE', prov: 'NO', descr: 'Novara', link_grp: 'https://t.me/c/1614195634/517?thread=508', link_telegram: ''},
|
||||||
{_id: 62, reg: 'SAR', prov: 'NU', descr: 'Nuoro', link_grp: 'https://t.me/c/1614195634/548?thread=542'},
|
{_id: 62, reg: 'SAR', prov: 'NU', descr: 'Nuoro', link_grp: 'https://t.me/c/1614195634/548?thread=542', link_telegram: ''},
|
||||||
{_id: 63, reg: 'SAR', prov: 'OT', descr: 'Olbia-Tempio', link_grp: ''},
|
{_id: 63, reg: 'SAR', prov: 'OT', descr: 'Olbia-Tempio', link_grp: '', link_telegram: ''},
|
||||||
{_id: 64, reg: 'SAR', prov: 'OR', descr: 'Oristano', link_grp: 'https://t.me/c/1614195634/550?thread=543'},
|
{_id: 64, reg: 'SAR', prov: 'OR', descr: 'Oristano', link_grp: 'https://t.me/c/1614195634/550?thread=543', link_telegram: ''},
|
||||||
{_id: 65, reg: 'VEN', prov: 'PD', descr: 'Padova', link_grp: 'https://t.me/c/1614195634/610?thread=600'},
|
{_id: 65, reg: 'VEN', prov: 'PD', descr: 'Padova', link_grp: 'https://t.me/c/1614195634/610?thread=600', link_telegram: ''},
|
||||||
{_id: 66, reg: 'SIC', prov: 'PA', descr: 'Palermo', link_grp: 'https://t.me/c/1614195634/568?thread=558'},
|
{_id: 66, reg: 'SIC', prov: 'PA', descr: 'Palermo', link_grp: 'https://t.me/c/1614195634/568?thread=558', link_telegram: ''},
|
||||||
{_id: 67, reg: 'EMR', prov: 'PR', descr: 'Parma', link_grp: 'https://t.me/c/1614195634/432?thread=423'},
|
{_id: 67, reg: 'EMR', prov: 'PR', descr: 'Parma', link_grp: 'https://t.me/c/1614195634/432?thread=423', link_telegram: ''},
|
||||||
{_id: 68, reg: 'LOM', prov: 'PV', descr: 'Pavia', link_grp: 'https://t.me/c/1614195634/499?thread=486'},
|
{_id: 68, reg: 'LOM', prov: 'PV', descr: 'Pavia', link_grp: 'https://t.me/c/1614195634/499?thread=486', link_telegram: ''},
|
||||||
{_id: 69, reg: 'UMB', prov: 'PG', descr: 'Perugia', link_grp: 'https://t.me/c/1614195634/403?thread=401'},
|
{_id: 69, reg: 'UMB', prov: 'PG', descr: 'Perugia', link_grp: 'https://t.me/c/1614195634/403?thread=401', link_telegram: ''},
|
||||||
{_id: 70, reg: 'MAR', prov: 'PU', descr: 'Pesaro e Urbino', link_grp: 'https://t.me/c/1614195634/454?thread=449'},
|
{_id: 70, reg: 'MAR', prov: 'PU', descr: 'Pesaro e Urbino', link_grp: 'https://t.me/c/1614195634/454?thread=449', link_telegram: ''},
|
||||||
{_id: 71, reg: 'ABR', prov: 'PE', descr: 'Pescara', link_grp: 'https://t.me/c/1614195634/368?thread=367'},
|
{_id: 71, reg: 'ABR', prov: 'PE', descr: 'Pescara', link_grp: 'https://t.me/c/1614195634/368?thread=367', link_telegram: ''},
|
||||||
{_id: 72, reg: 'EMR', prov: 'PC', descr: 'Piacenza', link_grp: 'https://t.me/c/1614195634/433?thread=424'},
|
{_id: 72, reg: 'EMR', prov: 'PC', descr: 'Piacenza', link_grp: 'https://t.me/c/1614195634/433?thread=424', link_telegram: ''},
|
||||||
{_id: 73, reg: 'TOS', prov: 'PI', descr: 'Pisa', link_grp: 'https://t.me/c/1614195634/589?thread=578'},
|
{_id: 73, reg: 'TOS', prov: 'PI', descr: 'Pisa', link_grp: 'https://t.me/c/1614195634/589?thread=578', link_telegram: ''},
|
||||||
{_id: 74, reg: 'TOS', prov: 'PT', descr: 'Pistoia', link_grp: 'https://t.me/c/1614195634/590?thread=579'},
|
{_id: 74, reg: 'TOS', prov: 'PT', descr: 'Pistoia', link_grp: 'https://t.me/c/1614195634/590?thread=579', link_telegram: ''},
|
||||||
{_id: 75, reg: 'FVG', prov: 'PN', descr: 'Pordenone', link_grp: 'https://t.me/c/1614195634/470?thread=466'},
|
{_id: 75, reg: 'FVG', prov: 'PN', descr: 'Pordenone', link_grp: 'https://t.me/c/1614195634/470?thread=466', link_telegram: ''},
|
||||||
{_id: 76, reg: 'BAS', prov: 'PZ', descr: 'Potenza', link_grp: 'https://t.me/c/1614195634/376?thread=375'},
|
{_id: 76, reg: 'BAS', prov: 'PZ', descr: 'Potenza', link_grp: 'https://t.me/c/1614195634/376?thread=375', link_telegram: ''},
|
||||||
{_id: 77, reg: 'TOS', prov: 'PO', descr: 'Prato', link_grp: 'https://t.me/c/1614195634/591?thread=580'},
|
{_id: 77, reg: 'TOS', prov: 'PO', descr: 'Prato', link_grp: 'https://t.me/c/1614195634/591?thread=580', link_telegram: ''},
|
||||||
{_id: 78, reg: 'SIC', prov: 'RG', descr: 'Ragusa', link_grp: 'https://t.me/c/1614195634/569?thread=559'},
|
{_id: 78, reg: 'SIC', prov: 'RG', descr: 'Ragusa', link_grp: 'https://t.me/c/1614195634/569?thread=559', link_telegram: ''},
|
||||||
{_id: 79, reg: 'EMR', prov: 'RA', descr: 'Ravenna', link_grp: 'https://t.me/c/1614195634/434?thread=425'},
|
{_id: 79, reg: 'EMR', prov: 'RA', descr: 'Ravenna', link_grp: 'https://t.me/c/1614195634/434?thread=425', link_telegram: ''},
|
||||||
{_id: 80, reg: 'CAL', prov: 'RC', descr: 'Reggio Calabria', link_grp: 'https://t.me/c/1614195634/385?thread=383'},
|
{_id: 80, reg: 'CAL', prov: 'RC', descr: 'Reggio Calabria', link_grp: 'https://t.me/c/1614195634/385?thread=383', link_telegram: ''},
|
||||||
{_id: 81, reg: 'EMR', prov: 'RE', descr: 'Reggio Emilia', link_grp: 'https://t.me/c/1614195634/435?thread=426'},
|
{_id: 81, reg: 'EMR', prov: 'RE', descr: 'Reggio Emilia', link_grp: 'https://t.me/c/1614195634/435?thread=426', link_telegram: ''},
|
||||||
{_id: 82, reg: 'LAZ', prov: 'RI', descr: 'Rieti', link_grp: 'https://t.me/c/1614195634/61?thread=45'},
|
{_id: 82, reg: 'LAZ', prov: 'RI', descr: 'Rieti', link_grp: 'https://t.me/c/1614195634/61?thread=45', link_telegram: ''},
|
||||||
{_id: 83, reg: 'EMR', prov: 'RN', descr: 'Rimini', link_grp: 'https://t.me/c/1614195634/436?thread=https://t.me/c/1614195634/64?thread=57427'},
|
{_id: 83, reg: 'EMR', prov: 'RN', descr: 'Rimini', link_grp: 'https://t.me/c/1614195634/436?thread=https://t.me/c/1614195634/64?thread=57427', link_telegram: ''},
|
||||||
{_id: 84, reg: 'LAZ', prov: 'RM', descr: 'Roma', link_grp: ''},
|
{_id: 84, reg: 'LAZ', prov: 'RM', descr: 'Roma', link_grp: '', link_telegram: ''},
|
||||||
{_id: 85, reg: 'VEN', prov: 'RO', descr: 'Rovigo', link_grp: 'https://t.me/c/1614195634/611?thread=601'},
|
{_id: 85, reg: 'VEN', prov: 'RO', descr: 'Rovigo', link_grp: 'https://t.me/c/1614195634/611?thread=601', link_telegram: ''},
|
||||||
{_id: 86, reg: 'CAM', prov: 'SA', descr: 'Salerno', link_grp: 'https://t.me/c/1614195634/416?thread=412'},
|
{_id: 86, reg: 'CAM', prov: 'SA', descr: 'Salerno', link_grp: 'https://t.me/c/1614195634/416?thread=412', link_telegram: ''},
|
||||||
{_id: 87, reg: 'SAR', prov: 'VS', descr: 'Medio Campidano', link_grp: ''},
|
{_id: 87, reg: 'SAR', prov: 'VS', descr: 'Medio Campidano', link_grp: '', link_telegram: ''},
|
||||||
{_id: 88, reg: 'SAR', prov: 'SS', descr: 'Sassari', link_grp: 'https://t.me/c/1614195634/551?thread=544'},
|
{_id: 88, reg: 'SAR', prov: 'SS', descr: 'Sassari', link_grp: 'https://t.me/c/1614195634/551?thread=544', link_telegram: ''},
|
||||||
{_id: 89, reg: 'LIG', prov: 'SV', descr: 'Savona', link_grp: 'https://t.me/c/1614195634/395?thread=391'},
|
{_id: 89, reg: 'LIG', prov: 'SV', descr: 'Savona', link_grp: 'https://t.me/c/1614195634/395?thread=391', link_telegram: ''},
|
||||||
{_id: 90, reg: 'TOS', prov: 'SI', descr: 'Siena', link_grp: 'https://t.me/c/1614195634/592?thread=581'},
|
{_id: 90, reg: 'TOS', prov: 'SI', descr: 'Siena', link_grp: 'https://t.me/c/1614195634/592?thread=581', link_telegram: ''},
|
||||||
{_id: 91, reg: 'SIC', prov: 'SR', descr: 'Siracusa', link_grp: 'https://t.me/c/1614195634/570?thread=560'},
|
{_id: 91, reg: 'SIC', prov: 'SR', descr: 'Siracusa', link_grp: 'https://t.me/c/1614195634/570?thread=560', link_telegram: ''},
|
||||||
{_id: 92, reg: 'LOM', prov: 'SO', descr: 'Sondrio', link_grp: 'https://t.me/c/1614195634/500?thread=487'},
|
{_id: 92, reg: 'LOM', prov: 'SO', descr: 'Sondrio', link_grp: 'https://t.me/c/1614195634/500?thread=487', link_telegram: ''},
|
||||||
{_id: 93, reg: 'PUG', prov: 'TA', descr: 'Taranto', link_grp: 'https://t.me/c/1614195634/539?thread=533'},
|
{_id: 93, reg: 'PUG', prov: 'TA', descr: 'Taranto', link_grp: 'https://t.me/c/1614195634/539?thread=533', link_telegram: ''},
|
||||||
{_id: 94, reg: 'ABR', prov: 'TE', descr: 'Teramo', link_grp: 'https://t.me/c/1614195634/370?thread=369'},
|
{_id: 94, reg: 'ABR', prov: 'TE', descr: 'Teramo', link_grp: 'https://t.me/c/1614195634/370?thread=369', link_telegram: ''},
|
||||||
{_id: 95, reg: 'UMB', prov: 'TR', descr: 'Terni', link_grp: 'https://t.me/c/1614195634/404?thread=402'},
|
{_id: 95, reg: 'UMB', prov: 'TR', descr: 'Terni', link_grp: 'https://t.me/c/1614195634/404?thread=402', link_telegram: ''},
|
||||||
{_id: 96, reg: 'PIE', prov: 'TO', descr: 'Torino', link_grp: 'https://t.me/c/1614195634/518?thread=509'},
|
{_id: 96, reg: 'PIE', prov: 'TO', descr: 'Torino', link_grp: 'https://t.me/c/1614195634/518?thread=509', link_telegram: ''},
|
||||||
{_id: 97, reg: 'SAR', prov: 'OG', descr: 'Ogliastra', link_grp: ''},
|
{_id: 97, reg: 'SAR', prov: 'OG', descr: 'Ogliastra', link_grp: '', link_telegram: ''},
|
||||||
{_id: 98, reg: 'SIC', prov: 'TP', descr: 'Trapani', link_grp: 'https://t.me/c/1614195634/571?thread=561'},
|
{_id: 98, reg: 'SIC', prov: 'TP', descr: 'Trapani', link_grp: 'https://t.me/c/1614195634/571?thread=561', link_telegram: ''},
|
||||||
{_id: 99, reg: 'TAA', prov: 'TN', descr: 'Trento', link_grp: 'https://t.me/c/1614195634/597?thread=595'},
|
{_id: 99, reg: 'TAA', prov: 'TN', descr: 'Trento', link_grp: 'https://t.me/c/1614195634/597?thread=595', link_telegram: ''},
|
||||||
{_id: 100, reg: 'VEN', prov: 'TV', descr: 'Treviso', link_grp: 'https://t.me/c/1614195634/612?thread=602'},
|
{_id: 100, reg: 'VEN', prov: 'TV', descr: 'Treviso', link_grp: 'https://t.me/c/1614195634/612?thread=602', link_telegram: ''},
|
||||||
{_id: 101, reg: 'FVG', prov: 'TS', descr: 'Trieste', link_grp: 'https://t.me/c/1614195634/471?thread=467'},
|
{_id: 101, reg: 'FVG', prov: 'TS', descr: 'Trieste', link_grp: 'https://t.me/c/1614195634/471?thread=467', link_telegram: ''},
|
||||||
{_id: 102, reg: 'FVG', prov: 'UD', descr: 'Udine', link_grp: 'https://t.me/c/1614195634/472?thread=468'},
|
{_id: 102, reg: 'FVG', prov: 'UD', descr: 'Udine', link_grp: 'https://t.me/c/1614195634/472?thread=468', link_telegram: ''},
|
||||||
{_id: 103, reg: 'LOM', prov: 'VA', descr: 'Varese', link_grp: 'https://t.me/c/1614195634/501?thread=488'},
|
{_id: 103, reg: 'LOM', prov: 'VA', descr: 'Varese', link_grp: 'https://t.me/c/1614195634/501?thread=488', link_telegram: ''},
|
||||||
{_id: 104, reg: 'VEN', prov: 'VE', descr: 'Venezia', link_grp: 'https://t.me/c/1614195634/613?thread=603'},
|
{_id: 104, reg: 'VEN', prov: 'VE', descr: 'Venezia', link_grp: 'https://t.me/c/1614195634/613?thread=603', link_telegram: ''},
|
||||||
{_id: 105, reg: 'PIE', prov: 'VB', descr: 'Verbano-Cusio-Ossola', link_grp: 'https://t.me/c/1614195634/519?thread=510 '},
|
{_id: 105, reg: 'PIE', prov: 'VB', descr: 'Verbano-Cusio-Ossola', link_grp: 'https://t.me/c/1614195634/519?thread=510 ', link_telegram: ''},
|
||||||
{_id: 106, reg: 'PIE', prov: 'VC', descr: 'Vercelli', link_grp: 'https://t.me/c/1614195634/512?thread=511'},
|
{_id: 106, reg: 'PIE', prov: 'VC', descr: 'Vercelli', link_grp: 'https://t.me/c/1614195634/512?thread=511', link_telegram: ''},
|
||||||
{_id: 107, reg: 'VEN', prov: 'VR', descr: 'Verona', link_grp: 'https://t.me/c/1614195634/614?thread=604'},
|
{_id: 107, reg: 'VEN', prov: 'VR', descr: 'Verona', link_grp: 'https://t.me/c/1614195634/614?thread=604', link_telegram: ''},
|
||||||
{_id: 108, reg: 'CAL', prov: 'VV', descr: 'Vibo Valentia', link_grp: 'https://t.me/c/1614195634/386?thread=384'},
|
{_id: 108, reg: 'CAL', prov: 'VV', descr: 'Vibo Valentia', link_grp: 'https://t.me/c/1614195634/386?thread=384', link_telegram: ''},
|
||||||
{_id: 109, reg: 'VEN', prov: 'VI', descr: 'Vicenza', link_grp: 'https://t.me/c/1614195634/615?thread=605'},
|
{_id: 109, reg: 'VEN', prov: 'VI', descr: 'Vicenza', link_grp: 'https://t.me/c/1614195634/615?thread=605', link_telegram: ''},
|
||||||
{_id: 110, reg: 'LAZ', prov: 'VT', descr: 'Viterbo', link_grp: 'https://t.me/c/1614195634/76?thread=74'},
|
{_id: 110, reg: 'LAZ', prov: 'VT', descr: 'Viterbo', link_grp: 'https://t.me/c/1614195634/76?thread=74', link_telegram: ''},
|
||||||
{_id: 111, reg: 'RSM', prov: 'RSM', descr: 'Repubblica di San Marino', link_grp: 'https://t.me/+HSdNurm0IXY1MGI0'},
|
{_id: 111, reg: 'RSM', prov: 'RSM', descr: 'Repubblica di San Marino', link_grp: 'https://t.me/+HSdNurm0IXY1MGI0', link_telegram: ''},
|
||||||
{_id: 112, reg: 'EST', prov: 'EST', descr: 'Estero', link_grp: ''},
|
{_id: 112, reg: 'EST', prov: 'EST', descr: 'Estero', link_grp: '', link_telegram: ''},
|
||||||
{_id: 113, reg: 'ONL', prov: 'ONL', descr: 'On Line', link_grp: ''},
|
{_id: 113, reg: 'ONL', prov: 'ONL', descr: 'On Line', link_grp: '', link_telegram: ''},
|
||||||
{_id: 114, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Est', link_grp: 'https://t.me/c/1614195634/64?thread=57'},
|
{_id: 114, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Est', link_grp: 'https://t.me/c/1614195634/64?thread=57', link_telegram: ''},
|
||||||
{_id: 115, reg: 'LAZ', prov: 'RM', descr: 'Roma Sud-Est', link_grp: 'https://t.me/c/1614195634/65?thread=58'},
|
{_id: 115, reg: 'LAZ', prov: 'RM', descr: 'Roma Sud-Est', link_grp: 'https://t.me/c/1614195634/65?thread=58', link_telegram: ''},
|
||||||
{_id: 116, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord', link_grp: 'https://t.me/c/1614195634/75?thread=73'},
|
{_id: 116, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord', link_grp: 'https://t.me/c/1614195634/75?thread=73', link_telegram: ''},
|
||||||
{_id: 117, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Ovest', link_grp: 'https://t.me/c/1614195634/62?thread=47'},
|
{_id: 117, reg: 'LAZ', prov: 'RM', descr: 'Roma Nord-Ovest', link_grp: 'https://t.me/c/1614195634/62?thread=47', link_telegram: ''},
|
||||||
{_id: 118, reg: 'LAZ', prov: 'RM', descr: 'Roma Sud e Litorale', link_grp: 'https://t.me/c/1614195634/67?thread=43'},
|
{_id: 118, reg: 'LAZ', prov: 'RM', descr: 'Roma Sud e Litorale', link_grp: 'https://t.me/c/1614195634/67?thread=43', link_telegram: ''},
|
||||||
{_id: 119, reg: 'PUG', prov: 'VAL', descr: 'Valle D\'Itria', link_grp: 'https://t.me/progettoriso/7016?thread=7015'},
|
{_id: 119, reg: 'PUG', prov: 'VAL', descr: 'Valle D\'Itria', link_grp: 'https://t.me/progettoriso/7016?thread=7015', link_telegram: ''},
|
||||||
{_id: 120, reg: 'SAR', prov: 'SUS', descr: 'Sud Sardegna', link_grp: 'https://t.me/c/1614195634/552?thread=545'},
|
{_id: 120, reg: 'SAR', prov: 'SUS', descr: 'Sud Sardegna', link_grp: 'https://t.me/c/1614195634/552?thread=545', link_telegram: ''},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ router.post('/load', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
data.account = await Account.getAccountByUsernameAndCircuitId(idapp, '', data._id, false, '', data.path);
|
data.account = await Account.getAccountByUsernameAndCircuitId(idapp, '', data._id, false, false, '', data.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp);
|
const arrrecnotif = await SendNotif.findAllNotifByUsernameIdAndIdApp(req.user.username, lastdr, idapp);
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ router.post('/settable', authenticate, async (req, res) => {
|
|||||||
} else if (params.table === 'hours') {
|
} else if (params.table === 'hours') {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ((mydata['_id'] === undefined || mydata['_id'] === '' || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined)) {
|
if ((mydata['_id'] === undefined || mydata['_id'] === '' || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined || mytablerec._id === '0')) {
|
||||||
mytablerec._id = new ObjectID();
|
mytablerec._id = new ObjectID();
|
||||||
mydata._id = new ObjectID();
|
mydata._id = new ObjectID();
|
||||||
}
|
}
|
||||||
@@ -1252,11 +1252,11 @@ router.post('/duprec/:table/:id', authenticate, async (req, res) => {
|
|||||||
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
|
/* if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
return res.status(404).
|
return res.status(404).
|
||||||
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||||
}
|
} */
|
||||||
|
|
||||||
return await mytable.findById(id).then(async (mydata) => {
|
return await mytable.findById(id).then(async (mydata) => {
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ router.post('/load', authenticate, async (req, res) => {
|
|||||||
for (let i = 0; i < data.mycircuits.length; i++) {
|
for (let i = 0; i < data.mycircuits.length; i++) {
|
||||||
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
||||||
if (mycirc)
|
if (mycirc)
|
||||||
data.mycircuits[i].account = await Account.getAccountByUsernameAndCircuitId(idapp, '', mycirc._id, true, groupname);
|
data.mycircuits[i].account = await Account.getAccountByUsernameAndCircuitId(idapp, '', mycirc._id, true, true, groupname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ router.post('/load', authenticate, async (req, res) => {
|
|||||||
for (let i = 0; i < data.mycircuits.length; i++) {
|
for (let i = 0; i < data.mycircuits.length; i++) {
|
||||||
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
||||||
if (mycirc)
|
if (mycirc)
|
||||||
data.mycircuits[i].account = await Account.getAccountByUsernameAndCircuitId(idapp, '', mycirc._id, true, groupname);
|
data.mycircuits[i].account = await Account.getAccountByUsernameAndCircuitId(idapp, '', mycirc._id, true, true, groupname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1311,6 +1311,10 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
|
|||||||
|
|
||||||
await Circuit.SetDefMinMaxCollettivi(idapp, mydata.valmin, mydata.valmax);
|
await Circuit.SetDefMinMaxCollettivi(idapp, mydata.valmin, mydata.valmax);
|
||||||
|
|
||||||
|
} else if (mydata.dbop === 'AbilitaTuttiCircuiti') {
|
||||||
|
|
||||||
|
await Circuit.AbilitaTuttiCircuiti(idapp);
|
||||||
|
|
||||||
} else if (mydata.dbop === 'setstrProvByIdCityCircuits') {
|
} else if (mydata.dbop === 'setstrProvByIdCityCircuits') {
|
||||||
|
|
||||||
await Circuit.setstrProvByIdCityCircuits(idapp);
|
await Circuit.setstrProvByIdCityCircuits(idapp);
|
||||||
@@ -1440,7 +1444,7 @@ async function eseguiDbOpUser(idapp, mydata, locale, req, res) {
|
|||||||
|
|
||||||
for (const mycirc of allcirc) {
|
for (const mycirc of allcirc) {
|
||||||
// Il Conto Comunitario prende il nome del circuito !
|
// Il Conto Comunitario prende il nome del circuito !
|
||||||
await Account.createAccount(idapp, '', mycirc.name, '', mycirc.path);
|
await Account.createAccount(idapp, '', mycirc.name, true, '', mycirc.path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -450,8 +450,6 @@ const Status = {
|
|||||||
|
|
||||||
const Cmd = {
|
const Cmd = {
|
||||||
VALIDATE_REGISTRATION: 1,
|
VALIDATE_REGISTRATION: 1,
|
||||||
RICHIESTA_GRUPPO: 2,
|
|
||||||
RICHIESTA_CIRCUIT: 3,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Destin = {
|
const Destin = {
|
||||||
@@ -891,37 +889,37 @@ const MyTelegramBot = {
|
|||||||
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + groupid,
|
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + groupid,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
|
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_FIDO) {
|
||||||
|
|
||||||
if (groupname) {
|
if (groupname) {
|
||||||
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP', locale: langdest }, groupname) + '<br>' + struserinfomsg;
|
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP', locale: langdest }, groupname) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
{
|
{
|
||||||
text: '✅ Accetta ' + groupname,
|
text: '✅ Abilita fido a ' + groupname,
|
||||||
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
||||||
groupid + tools.SEP + groupname,
|
groupid + tools.SEP + groupname,
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
text: '🚫 Rifiuta ' + groupname,
|
text: '🚫 Rifiuta ' + groupname,
|
||||||
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
||||||
groupid + tools.SEP + groupname,
|
groupid + tools.SEP + groupname,
|
||||||
},
|
},*/
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, name) + '<br>' + struserinfomsg;
|
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
{
|
{
|
||||||
text: '✅ Accetta ' + myuser.username,
|
text: '✅ Abilita fido a ' + myuser.username,
|
||||||
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
||||||
groupid,
|
groupid,
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
text: '🚫 Rifiuta ' + myuser.username,
|
text: '🚫 Rifiuta ' + myuser.username,
|
||||||
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
||||||
groupid,
|
groupid,
|
||||||
},
|
}, */
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2809,8 +2807,6 @@ class Telegram {
|
|||||||
async setCmdToUsername(rec, username, cmd_to_set, valuebool) {
|
async setCmdToUsername(rec, username, cmd_to_set, valuebool) {
|
||||||
if (cmd_to_set === Cmd.VALIDATE_REGISTRATION) {
|
if (cmd_to_set === Cmd.VALIDATE_REGISTRATION) {
|
||||||
return await User.setVerifiedByAportador(rec.user.idapp, username, valuebool);
|
return await User.setVerifiedByAportador(rec.user.idapp, username, valuebool);
|
||||||
} else if (cmd_to_set === Cmd.RICHIESTA_GRUPPO) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4083,20 +4079,14 @@ if (true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (data.action === InlineConferma.RISPOSTA_SI + shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
|
} else if (data.action === InlineConferma.RISPOSTA_SI + shared_consts.CallFunz.RICHIESTA_FIDO) {
|
||||||
|
|
||||||
if (circuit) {
|
if (circuit) {
|
||||||
cmd = shared_consts.CIRCUITCMD.SET;
|
cmd = shared_consts.CIRCUITCMD.SETFIDO;
|
||||||
let foundIfAlreadyCircuit = false;
|
// Aggiungilo nel Circuito
|
||||||
if (data.groupname) {
|
// await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
|
||||||
foundIfAlreadyCircuit = await MyGroup.ifCircuitAlreadyInGroup(user.idapp, data.groupname, circuit.name);
|
// Abiglitagli il Fido
|
||||||
} else {
|
await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
|
||||||
foundIfAlreadyCircuit = await User.ifAlreadyInCircuit(user.idapp, data.username, circuit.name);
|
|
||||||
}
|
|
||||||
if (!foundIfAlreadyCircuit) {
|
|
||||||
// Aggiungilo nel Circuito
|
|
||||||
await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
|
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
|
||||||
|
|
||||||
|
|||||||
@@ -1093,11 +1093,13 @@ module.exports = {
|
|||||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER;
|
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER;
|
||||||
// paramsObj.options = MessageOptions.Notify_OnlyToNotifinApp + MessageOptions.Notify_ByBotTelegram;
|
// paramsObj.options = MessageOptions.Notify_OnlyToNotifinApp + MessageOptions.Notify_ByBotTelegram;
|
||||||
const myuserdata = await User.getUserShortDataByUsername(idapp, username_action);
|
const myuserdata = await User.getUserShortDataByUsername(idapp, username_action);
|
||||||
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_CIRCUIT, myuserdata, usernameDest, circuitname,
|
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_FIDO, myuserdata, usernameDest, circuitname,
|
||||||
myreccircuit._id, '', extrarec.groupname);
|
myreccircuit._id, '', extrarec.groupname);
|
||||||
onlysave = false;
|
onlysave = false;
|
||||||
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
|
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
|
||||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_ADDED_ADMIN;
|
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_ADDED_ADMIN;
|
||||||
|
} else if (cmd === shared_consts.CIRCUITCMD.SETFIDO) {
|
||||||
|
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_SETFIDO;
|
||||||
} else if (cmd === shared_consts.CIRCUITCMD.REMOVEADMIN) {
|
} else if (cmd === shared_consts.CIRCUITCMD.REMOVEADMIN) {
|
||||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN;
|
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN;
|
||||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
||||||
@@ -1938,149 +1940,156 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addNumFavoriteAndBookmarkToQuery(idapp, numtab) {
|
addNumFavoriteAndBookmarkToQuery(idapp, numtab) {
|
||||||
let query =
|
|
||||||
[{
|
|
||||||
$lookup: {
|
|
||||||
from: 'users',
|
|
||||||
let: {
|
|
||||||
tab: numtab,
|
|
||||||
id: '$_id',
|
|
||||||
},
|
|
||||||
pipeline: [
|
|
||||||
{
|
|
||||||
$unwind: '$profile.favorite',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
$expr: {
|
|
||||||
$and: [
|
|
||||||
{ $eq: ['$profile.favorite.id', '$$id'] },
|
|
||||||
{ $eq: ['$profile.favorite.tab', '$$tab'] },
|
|
||||||
{ $eq: ['$idapp', idapp] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ $project: { username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1, 'profile.qualifica': 1 } },
|
|
||||||
],
|
|
||||||
as: 'myfav',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: "users",
|
|
||||||
let: {
|
|
||||||
tab: numtab,
|
|
||||||
id: '$_id',
|
|
||||||
},
|
|
||||||
pipeline: [
|
|
||||||
{
|
|
||||||
$unwind: '$profile.bookmark',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
$expr: {
|
|
||||||
$and: [
|
|
||||||
{ $eq: ['$profile.bookmark.id', '$$id'] },
|
|
||||||
{ $eq: ['$profile.bookmark.tab', '$$tab'] },
|
|
||||||
{ $eq: ['$idapp', idapp] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$project: {
|
|
||||||
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
|
||||||
'profile.qualifica': 1,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
as: 'mybook',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: "users",
|
|
||||||
let: {
|
|
||||||
tab: numtab,
|
|
||||||
id: '$_id',
|
|
||||||
},
|
|
||||||
pipeline: [
|
|
||||||
{
|
|
||||||
$unwind: '$profile.seen',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
$expr: {
|
|
||||||
$and: [
|
|
||||||
{ $eq: ['$profile.seen.id', '$$id'] },
|
|
||||||
{ $eq: ['$profile.seen.tab', '$$tab'] },
|
|
||||||
{ $eq: ['$idapp', idapp] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$project: {
|
|
||||||
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
|
||||||
'profile.qualifica': 1,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
as: 'myseen',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: "users",
|
|
||||||
let: {
|
|
||||||
tab: numtab,
|
|
||||||
id: '$_id',
|
|
||||||
},
|
|
||||||
pipeline: [
|
|
||||||
{
|
|
||||||
$unwind: '$profile.attend',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$match: {
|
|
||||||
$expr: {
|
|
||||||
$and: [
|
|
||||||
{ $eq: ['$profile.attend.id', '$$id'] },
|
|
||||||
{ $eq: ['$profile.attend.tab', '$$tab'] },
|
|
||||||
{ $eq: ['$idapp', idapp] },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$project: {
|
|
||||||
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
|
||||||
'profile.qualifica': 1,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
as: 'myattend',
|
|
||||||
},
|
|
||||||
}];
|
|
||||||
|
|
||||||
const numtabbacheca = this.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
let query = {};
|
||||||
if (numtab === numtabbacheca) {
|
try {
|
||||||
const queryadd = this.getQueryMyBacheca();
|
query =
|
||||||
query = [...query, ...queryadd];
|
[{
|
||||||
|
$lookup: {
|
||||||
|
from: 'users',
|
||||||
|
let: {
|
||||||
|
tab: numtab,
|
||||||
|
id: '$_id',
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$unwind: '$profile.favorite',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{ $eq: ['$profile.favorite.id', '$$id'] },
|
||||||
|
{ $eq: ['$profile.favorite.tab', '$$tab'] },
|
||||||
|
{ $eq: ['$idapp', idapp] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ $project: { username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1, 'profile.qualifica': 1 } },
|
||||||
|
],
|
||||||
|
as: 'myfav',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
let: {
|
||||||
|
tab: numtab,
|
||||||
|
id: '$_id',
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$unwind: '$profile.bookmark',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{ $eq: ['$profile.bookmark.id', '$$id'] },
|
||||||
|
{ $eq: ['$profile.bookmark.tab', '$$tab'] },
|
||||||
|
{ $eq: ['$idapp', idapp] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
as: 'mybook',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
let: {
|
||||||
|
tab: numtab,
|
||||||
|
id: '$_id',
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$unwind: '$profile.seen',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{ $eq: ['$profile.seen.id', '$$id'] },
|
||||||
|
{ $eq: ['$profile.seen.tab', '$$tab'] },
|
||||||
|
{ $eq: ['$idapp', idapp] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
as: 'myseen',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "users",
|
||||||
|
let: {
|
||||||
|
tab: numtab,
|
||||||
|
id: '$_id',
|
||||||
|
},
|
||||||
|
pipeline: [
|
||||||
|
{
|
||||||
|
$unwind: '$profile.attend',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$match: {
|
||||||
|
$expr: {
|
||||||
|
$and: [
|
||||||
|
{ $eq: ['$profile.attend.id', '$$id'] },
|
||||||
|
{ $eq: ['$profile.attend.tab', '$$tab'] },
|
||||||
|
{ $eq: ['$idapp', idapp] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$project: {
|
||||||
|
username: 1, name: 1, surname: 1, 'profile.resid_province': 1, 'profile.img': 1,
|
||||||
|
'profile.qualifica': 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
as: 'myattend',
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
|
||||||
|
const numtabbacheca = this.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||||
|
if (numtab === numtabbacheca) {
|
||||||
|
const queryadd = this.getQueryMyBacheca(idapp);
|
||||||
|
query = [...query, ...queryadd];
|
||||||
|
}
|
||||||
|
|
||||||
|
proj = {
|
||||||
|
myfav: 1,
|
||||||
|
mybook: 1,
|
||||||
|
myseen: 1,
|
||||||
|
myattend: 1,
|
||||||
|
mybookings: 1,
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
proj = {
|
|
||||||
myfav: 1,
|
|
||||||
mybook: 1,
|
|
||||||
myseen: 1,
|
|
||||||
myattend: 1,
|
|
||||||
mybookings: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
return { query, proj };
|
return { query, proj };
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getQueryMyBacheca: function () {
|
getQueryMyBacheca: function (idapp) {
|
||||||
|
|
||||||
const arrquery = [{
|
const arrquery = [{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ module.exports = {
|
|||||||
CREATE: 1001,
|
CREATE: 1001,
|
||||||
REQ: 2000,
|
REQ: 2000,
|
||||||
SET: 2001,
|
SET: 2001,
|
||||||
|
SETFIDO: 2005,
|
||||||
REMOVE_FROM_MYLIST: 2144,
|
REMOVE_FROM_MYLIST: 2144,
|
||||||
REFUSE_REQ: 2145,
|
REFUSE_REQ: 2145,
|
||||||
CANCEL_REQ: 2146,
|
CANCEL_REQ: 2146,
|
||||||
@@ -318,6 +319,7 @@ module.exports = {
|
|||||||
RICHIESTA_AMICIZIA: 15,
|
RICHIESTA_AMICIZIA: 15,
|
||||||
RICHIESTA_HANDSHAKE: 16,
|
RICHIESTA_HANDSHAKE: 16,
|
||||||
RICHIESTA_CIRCUIT: 20,
|
RICHIESTA_CIRCUIT: 20,
|
||||||
|
RICHIESTA_FIDO: 25,
|
||||||
},
|
},
|
||||||
|
|
||||||
OrderStatus: {
|
OrderStatus: {
|
||||||
@@ -452,6 +454,7 @@ module.exports = {
|
|||||||
ID_CIRCUIT_SENDCOINSREQ_SENT: 4096,
|
ID_CIRCUIT_SENDCOINSREQ_SENT: 4096,
|
||||||
ID_CIRCUIT_COINS_ACCEPTED_SENT: 8192,
|
ID_CIRCUIT_COINS_ACCEPTED_SENT: 8192,
|
||||||
ID_CIRCUIT_COINS_REFUSED_SENT: 16384,
|
ID_CIRCUIT_COINS_REFUSED_SENT: 16384,
|
||||||
|
ID_CIRCUIT_SETFIDO: 32768,
|
||||||
|
|
||||||
TYPEDIR_BOOKING: 6,
|
TYPEDIR_BOOKING: 6,
|
||||||
|
|
||||||
@@ -579,7 +582,7 @@ module.exports = {
|
|||||||
'idGood': 1,
|
'idGood': 1,
|
||||||
'idShipping': 1,
|
'idShipping': 1,
|
||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
//**ADDFIELD_MYGOOD
|
//**ADDFIELD_MYGOOD
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (table === this.TABLES_MYGROUPS) {
|
} else if (table === this.TABLES_MYGROUPS) {
|
||||||
@@ -695,7 +698,10 @@ module.exports = {
|
|||||||
max_partecip: 1,
|
max_partecip: 1,
|
||||||
contribstr: 1,
|
contribstr: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
//**ADDFIELD_MYBACHECAS
|
'mygrp.groupname': 1,
|
||||||
|
'mygrp.title': 1,
|
||||||
|
'mygrp.photos': 1,
|
||||||
|
//**ADDFIELD_MYBACHECAS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,6 +726,7 @@ module.exports = {
|
|||||||
username: 1,
|
username: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
|
groupname: 1,
|
||||||
lasttimeonline: 1,
|
lasttimeonline: 1,
|
||||||
comune: 1,
|
comune: 1,
|
||||||
mycities: 1,
|
mycities: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user