keyvalue storage using data in the profile
This commit is contained in:
@@ -81,6 +81,24 @@ userDB = (DB) => {
|
||||
});
|
||||
}
|
||||
|
||||
DB.getData = async (profileid, key) => {
|
||||
let profile = await DB.getProfile(profileid);
|
||||
return profile.data[key];
|
||||
}
|
||||
|
||||
DB.setData = async (profileid, key, value) => {
|
||||
const _id = DB.ObjectID(profileid);
|
||||
let update = {
|
||||
$set:{
|
||||
["data." + key]: value
|
||||
}
|
||||
}
|
||||
return DB.profileCols.updateOne({_id}, update).catch((err)=>{
|
||||
console.log(err);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
DB.addNotification = async (profileid, message) => {
|
||||
const _id = DB.ObjectID(profileid);
|
||||
let update = {
|
||||
|
||||
Reference in New Issue
Block a user