use ReactiveMiniMongoIndex for notifications

This commit is contained in:
Martin Filser 2023-11-07 19:07:06 +01:00
parent 402528d97e
commit c4882707e9
2 changed files with 24 additions and 2 deletions

View file

@ -1410,6 +1410,28 @@ ReactiveMiniMongoIndex = {
}
}
return ret;
},
getActivityWithId(activityId, addSelect = {}, options) {
let ret = []
if (activityId) {
const select = {addSelect, options}
if (!this.__activityWithId) {
this.__activityWithId = new DataCache(_select => {
const __select = EJSON.parse(_select);
const _activities = ReactiveCache.getActivities(
{ _id: { $exists: true },
...__select.addSelect,
}, __select.options);
const _ret = _.indexBy(_activities, '_id')
return _ret;
});
}
ret = this.__activityWithId.get(EJSON.stringify(select));
if (ret) {
ret = ret[activityId];
}
}
return ret;
}
}