- L'utente entra direttamente sul circuito, con fido a zero.

++Abilitazione Fido utente (per admin).
This commit is contained in:
Surya Paolo
2023-06-01 11:39:53 +02:00
parent 0945f1af08
commit a79e79a85e
19 changed files with 615 additions and 418 deletions

View File

@@ -1093,11 +1093,13 @@ module.exports = {
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER;
// paramsObj.options = MessageOptions.Notify_OnlyToNotifinApp + MessageOptions.Notify_ByBotTelegram;
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);
onlysave = false;
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
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) {
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REMOVED_ADMIN;
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
@@ -1938,149 +1940,156 @@ module.exports = {
},
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);
if (numtab === numtabbacheca) {
const queryadd = this.getQueryMyBacheca();
query = [...query, ...queryadd];
let query = {};
try {
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);
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 };
},
getQueryMyBacheca: function () {
getQueryMyBacheca: function (idapp) {
const arrquery = [{
$lookup: {