add private groups

This commit is contained in:
Adolfo Reyna
2021-09-25 21:20:41 -07:00
parent 83941c59d5
commit 070912f2d3
7 changed files with 77 additions and 30 deletions

View File

@@ -127,12 +127,15 @@ postDB = (DB)=>{
{profileid: {
$in: ids
}},
{toProfile: {
$in: ids
}}
//{toProfile: {
// $in: ids
//}}
]
};
return DB.postCols.find(query).sort({lastUpdated: -1}).limit(20).toArray().catch((err)=>{
return DB.postCols.find(query).sort({lastUpdated: -1}).limit(20).toArray().then(async (posts)=>{
//we need to filter when toProfile is private and not part of the following array
return posts;
}).catch((err)=>{
console.log(err);
return false;
});
@@ -140,7 +143,7 @@ postDB = (DB)=>{
DB.getPostsOfUser = (userId) => {
let userid = DB.ObjectID(userId);
return DB.postCols.find({userid}).sort({_id: -1}).toArray().catch((err)=>{
return DB.postCols.find({userid}).sort({_id: -1}).limit(20).toArray().catch((err)=>{
console.log(err);
return false;
});