feat: add post translation queue and background AI translation via API
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user