mirror of
https://github.com/wekan/wekan.git
synced 2026-02-17 13:38:07 +01:00
ReactiveMiniMongoIndex, added getChecklistItemsWithChecklistId
This commit is contained in:
parent
f80ecded0a
commit
316acd0366
2 changed files with 24 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue