feed with followers only
This commit is contained in:
@@ -45,6 +45,32 @@ userDB = (DB) => {
|
||||
return r[index];
|
||||
}
|
||||
|
||||
DB.followProfile = async (profileId, followProfileId)=>{
|
||||
const _id = DB.ObjectID(profileId);
|
||||
let update = {
|
||||
$addToSet:{
|
||||
following: followProfileId
|
||||
}
|
||||
}
|
||||
return DB.profileCols.updateOne({_id}, update).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
DB.unfollowProfile = async (profileId, followProfileId)=>{
|
||||
const _id = DB.ObjectID(profileId);
|
||||
let update = {
|
||||
$pull:{
|
||||
following: followProfileId
|
||||
}
|
||||
}
|
||||
return DB.profileCols.updateOne({_id}, update).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
//Groups
|
||||
DB.getGroups = async () => {
|
||||
let r = await DB.profileCols.find({isGroup: true})
|
||||
@@ -75,6 +101,7 @@ userDB = (DB) => {
|
||||
["subscribed." + profileid]: new Date()
|
||||
}
|
||||
}
|
||||
DB.followProfile(profileid, groupid)
|
||||
return DB.profileCols.updateOne({_id}, update).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
@@ -88,6 +115,7 @@ userDB = (DB) => {
|
||||
["subscribed." + profileid]: "",
|
||||
}
|
||||
}
|
||||
DB.unfollowProfile(profileid, groupid)
|
||||
return DB.profileCols.updateOne({_id}, update).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user