aggiunto "Seen"

This commit is contained in:
Surya Paolo
2023-04-13 14:27:00 +02:00
parent cda0bff21f
commit eea6e63c58
5 changed files with 60 additions and 0 deletions

View File

@@ -1980,11 +1980,44 @@ module.exports = {
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',
},
},
];
proj = {
myfav: 1,
mybook: 1,
myseen: 1,
};
return { query, proj };

View File

@@ -149,6 +149,7 @@ module.exports = {
CMD_USER: {
SET_FAVORITE: 1,
SET_BOOKMARK: 2,
SET_SEEN: 3,
},
TABLES_ENABLE_GETREC_BYID: ['mybachecas', 'myhosps', 'myskills', 'mygoods'],
@@ -579,6 +580,7 @@ module.exports = {
'profile.username_telegram': 1,
'profile.favorite': 1,
'profile.bookmark': 1,
'profile.seen': 1,
reported: 1,
date_report: 1,
username_who_report: 1,