Invio RIS da User a Conto Comunitario

This commit is contained in:
Surya Paolo
2023-02-01 23:50:39 +01:00
parent aa9d27c8fd
commit 2d213b7020

View File

@@ -172,7 +172,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'userfrom', as: 'userfrom',
}, },
}, },
{$unwind: '$userfrom'}, {
$unwind: {
path: '$userfrom',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'mygroups', from: 'mygroups',
@@ -195,7 +200,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'groupfrom', as: 'groupfrom',
}, },
}, },
{$unwind: '$groupfrom'}, {
$unwind: {
path: '$groupfrom',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'circuits', from: 'circuits',
@@ -218,7 +228,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'contocomfrom', as: 'contocomfrom',
}, },
}, },
{$unwind: '$contocomfrom'}, {
$unwind: {
path: '$contocomfrom',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'accounts', from: 'accounts',
@@ -272,7 +287,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'userto', as: 'userto',
}, },
}, },
{$unwind: '$userto'}, {
$unwind: {
path: '$userto',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'mygroups', from: 'mygroups',
@@ -295,7 +315,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'groupto', as: 'groupto',
}, },
}, },
{$unwind: '$groupto'}, {
$unwind: {
path: '$groupto',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'circuits', from: 'circuits',
@@ -318,7 +343,12 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
as: 'contocomto', as: 'contocomto',
}, },
}, },
{$unwind: '$contocomto'}, {
$unwind: {
path: '$contocomto',
preserveNullAndEmptyArrays: true,
},
},
{ {
$project: $project:
{ {
@@ -333,9 +363,15 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function(idapp, username,
'userto.username': 1, 'userto.username': 1,
'userto.profile.img': 1, 'userto.profile.img': 1,
'groupfrom.groupname': 1, 'groupfrom.groupname': 1,
'groupfrom.descr': 1,
'groupfrom.photos': 1,
'groupto.groupname': 1, 'groupto.groupname': 1,
'groupto.descr': 1,
'groupto.photos': 1,
'contocomfrom.path': 1, 'contocomfrom.path': 1,
'contocomfrom.name': 1,
'contocomto.path': 1, 'contocomto.path': 1,
'contocomto.name': 1,
}, },
}, },
@@ -599,9 +635,13 @@ MovementSchema.statics.getQueryAllUsersMovsByCircuitId = async function(idapp, c
'userto.username': 1, 'userto.username': 1,
'userto.profile.img': 1, 'userto.profile.img': 1,
'groupfrom.groupname': 1, 'groupfrom.groupname': 1,
'groupfrom.descr': 1,
'groupto.groupname': 1, 'groupto.groupname': 1,
'groupto.descr': 1,
'contocomfrom.path': 1, 'contocomfrom.path': 1,
'contocomfrom.name': 1,
'contocomto.path': 1, 'contocomto.path': 1,
'contocomto.name': 1,
}, },
}, },