feat: add post translation queue and background AI translation via API

This commit is contained in:
Adolfo Reyna
2026-02-25 18:41:46 -05:00
parent 989fdce883
commit c5fd09d71d
3 changed files with 55 additions and 1 deletions

View File

@@ -38,6 +38,20 @@ postDB = (DB)=>{
});
}
DB.addTranslation = (postid, lang, translatedText) => {
if(!DB.ObjectID.isValid(postid)) return false;
const id = DB.ObjectID(postid);
let update = {
$set:{
["translations." + lang]: translatedText
}
}
return DB.postCols.updateOne({_id: id}, update).catch((err)=>{
console.log(err);
return false;
});
}
DB.newReaction = (postid, profileid, reaction) => {
if(!DB.ObjectID.isValid(postid)) return false;
const id = DB.ObjectID(postid);