add update post endpoint

This commit is contained in:
aeroreyna
2022-09-10 13:13:04 -04:00
parent 605ddac037
commit 6b6f263821
2 changed files with 32 additions and 0 deletions

View File

@@ -19,6 +19,23 @@ postDB = (DB)=>{
});
}
DB.updatePost = (postid, newContent, oldContent) => {
const id = DB.ObjectID(postid);
let update = {
$set:{
content: newContent,
// lastUpdated: new Date() // add back when finish updating videos.
},
$push: {
contentHistory: oldContent
}
}
return DB.postCols.updateOne({_id: id}, update).catch((err)=>{
console.log(err);
return false;
});
}
DB.newReaction = (postid, profileid, reaction) => {
const id = DB.ObjectID(postid);
let update = {