Delete profiles and posts
This commit is contained in:
@@ -11,6 +11,14 @@ postDB = (DB)=>{
|
||||
});
|
||||
}
|
||||
|
||||
DB.removePost = (postid) => {
|
||||
const _id = DB.ObjectID(postid);
|
||||
return DB.postCols.deleteOne({_id}).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
DB.newReaction = (postid, profileid, reaction) => {
|
||||
const id = DB.ObjectID(postid);
|
||||
let update = {
|
||||
@@ -147,6 +155,7 @@ postDB = (DB)=>{
|
||||
|
||||
DB.getFeed = async (profileId) => {
|
||||
const profile = await DB.getProfile(profileId);
|
||||
if(!profile) return [];
|
||||
let ids = profile.following.map((id)=>DB.ObjectID(id));
|
||||
ids.push(DB.ObjectID(profileId))
|
||||
query = {
|
||||
|
||||
@@ -12,6 +12,15 @@ userDB = (DB) => {
|
||||
});
|
||||
}
|
||||
|
||||
DB.removeProfile = (profileid) => {
|
||||
const _id = DB.ObjectID(profileid);
|
||||
if (userProfileCache[profileid]) delete userProfileCache[profileid];
|
||||
return DB.profileCols.deleteOne({_id}).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
DB.updateProfile = async (profileid, profileObj) => {
|
||||
let tempProfile = profileObj.toObj();
|
||||
const query = {_id: profileid};
|
||||
|
||||
Reference in New Issue
Block a user