ReactiveMiniMongoIndex, added getChecklistItemsWithChecklistId

This commit is contained in:
Martin Filser 2023-03-03 20:32:18 +01:00
parent f80ecded0a
commit 316acd0366
2 changed files with 24 additions and 7 deletions

View file

@ -1129,6 +1129,28 @@ ReactiveMiniMongoIndex = {
}
}
return ret;
},
getChecklistItemsWithChecklistId(checklistId, addSelect = {}, options) {
let ret = []
if (checklistId) {
const select = {addSelect, options}
if (!this.__checklistItemsWithId) {
this.__checklistItemsWithId = new DataCache(_select => {
const __select = Jsons.parse(_select);
const _checklistItems = ReactiveCache.getChecklistItems(
{ checklistId: { $exists: true },
...__select.addSelect,
}, __select.options);
const _ret = _.groupBy(_checklistItems, 'checklistId')
return _ret;
});
}
ret = this.__checklistItemsWithId.get(Jsons.stringify(select));
if (ret) {
ret = ret[checklistId] || [];
}
}
return ret;
}
}