sending emails when new post to profiles

This commit is contained in:
Adolfo Reyna
2021-09-14 11:19:44 -07:00
parent f92aa70621
commit f2ebec71aa
6 changed files with 92 additions and 3 deletions

View File

@@ -23,6 +23,17 @@ userDB = (DB) => {
return r;
}
DB.getProfileCache = async (profileId) => {
if (userProfileCache[profileId] && !userProfileCache[profileId].isGroup) return userProfileCache[profileId];
const _id = DB.ObjectID(profileId);
let r = await DB.profileCols.findOne({ _id }).catch((err) => {
console.log(err);
return false;
});
if (r) userProfileCache[profileId] = r;
return r;
}
DB.getProfiles = async (query) => {
let r = await DB.profileCols.find({isGroup: false})
.sort({ lastUpdate: -1 }).limit(20)