Conti Comunitari e Collettivi
This commit is contained in:
@@ -128,7 +128,7 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
|
||||
if (!circuitId) {
|
||||
return [];
|
||||
}
|
||||
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false);
|
||||
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, '');
|
||||
|
||||
if (myaccount) {
|
||||
|
||||
@@ -196,6 +196,29 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
|
||||
},
|
||||
},
|
||||
{$unwind: '$groupfrom'},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'circuits',
|
||||
let: {contocom: '$accfrom.contocom', idapp: '$accfrom.idapp'},
|
||||
pipeline: [
|
||||
{
|
||||
$match:
|
||||
{
|
||||
$expr:
|
||||
{
|
||||
$and:
|
||||
[
|
||||
{$eq: ['$$contocom', '$path']},
|
||||
{$eq: ['$$idapp', '$idapp']},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
as: 'contocomfrom',
|
||||
},
|
||||
},
|
||||
{$unwind: '$contocomfrom'},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'accounts',
|
||||
@@ -273,6 +296,29 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
|
||||
},
|
||||
},
|
||||
{$unwind: '$groupto'},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'circuits',
|
||||
let: {contocom: '$accto.contocom', idapp: '$accto.idapp'},
|
||||
pipeline: [
|
||||
{
|
||||
$match:
|
||||
{
|
||||
$expr:
|
||||
{
|
||||
$and:
|
||||
[
|
||||
{$eq: ['$$contocom', '$path']},
|
||||
{$eq: ['$$idapp', '$idapp']},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
as: 'contocomto',
|
||||
},
|
||||
},
|
||||
{$unwind: '$contocomto'},
|
||||
{
|
||||
$project:
|
||||
{
|
||||
@@ -288,6 +334,8 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
|
||||
'userto.profile.img': 1,
|
||||
'groupfrom.groupname': 1,
|
||||
'groupto.groupname': 1,
|
||||
'contocomfrom.path': 1,
|
||||
'contocomto.path': 1,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -380,6 +428,34 @@ MovementSchema.statics.getQueryAllUsersMovsByCircuitId = async function(idapp, c
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'circuits',
|
||||
let: {contocom: '$accfrom.contocom', idapp: '$accfrom.idapp'},
|
||||
pipeline: [
|
||||
{
|
||||
$match:
|
||||
{
|
||||
$expr:
|
||||
{
|
||||
$and:
|
||||
[
|
||||
{$eq: ['$$contocom', '$path']},
|
||||
{$eq: ['$$idapp', '$idapp']},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
as: 'contocomfrom',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$contocomfrom',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'accounts',
|
||||
@@ -481,6 +557,34 @@ MovementSchema.statics.getQueryAllUsersMovsByCircuitId = async function(idapp, c
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'circuits',
|
||||
let: {contocom: '$accto.contocom', idapp: '$accto.idapp'},
|
||||
pipeline: [
|
||||
{
|
||||
$match:
|
||||
{
|
||||
$expr:
|
||||
{
|
||||
$and:
|
||||
[
|
||||
{$eq: ['$$contocom', '$path']},
|
||||
{$eq: ['$$idapp', '$idapp']},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
as: 'contocomto',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$contocomto',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project:
|
||||
{
|
||||
@@ -496,6 +600,8 @@ MovementSchema.statics.getQueryAllUsersMovsByCircuitId = async function(idapp, c
|
||||
'userto.profile.img': 1,
|
||||
'groupfrom.groupname': 1,
|
||||
'groupto.groupname': 1,
|
||||
'contocomfrom.path': 1,
|
||||
'contocomto.path': 1,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user