Move every Cards.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory server/)

This commit is contained in:
Martin Filser 2023-03-12 11:25:15 +01:00
parent a533605608
commit 2a2ed1eb2c
3 changed files with 31 additions and 15 deletions

View file

@ -65,7 +65,7 @@ Meteor.publishRelations('boards', function() {
)
);
this.cursor(
Cards.find(
ReactiveCache.getCards(
{ boardId, archived: false },
{ fields: {
_id: 1,
@ -73,7 +73,8 @@ Meteor.publishRelations('boards', function() {
listId: 1,
archived: 1,
sort: 1
}}
}},
true,
)
);
}
@ -271,10 +272,13 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
linkedBoardCards.selector = _ids => ({ boardId: _ids });
this.cursor(
Cards.find({
boardId: { $in: [boardId, board.subtasksDefaultBoardId] },
archived: isArchived,
}),
ReactiveCache.getCards({
boardId: { $in: [boardId, board.subtasksDefaultBoardId] },
archived: isArchived,
},
{},
true,
),
function(cardId, card) {
if (card.type === 'cardType-linkedCard') {
const impCardId = card.linkedId;

View file

@ -56,7 +56,11 @@ import Team from "../../models/team";
Meteor.publish('card', cardId => {
check(cardId, String);
const ret = Cards.find({ _id: cardId });
const ret = ReactiveCache.getCards(
{ _id: cardId },
{},
true,
);
return ret;
});
@ -66,7 +70,11 @@ Meteor.publish('card', cardId => {
Meteor.publishRelations('popupCardData', function(cardId) {
check(cardId, String);
this.cursor(
Cards.find({_id: cardId}),
ReactiveCache.getCards(
{ _id: cardId },
{},
true,
),
function(cardId, card) {
this.cursor(ReactiveCache.getBoards({_id: card.boardId}, {}, true));
this.cursor(Lists.find({boardId: card.boardId}));
@ -680,7 +688,7 @@ function findCards(sessionId, query) {
// eslint-disable-next-line no-console
// console.log('projection:', query.projection);
const cards = Cards.find(query.selector, query.projection);
const cards = ReactiveCache.getCards(query.selector, query.projection, true);
// eslint-disable-next-line no-console
// console.log('count:', cards.count());

View file

@ -22,13 +22,17 @@ Meteor.publish('notificationAttachments', function() {
// gets all cards associated with activities associated with the current user
Meteor.publish('notificationCards', function() {
const ret = Cards.find({
_id: {
$in: activities()
.map(v => v.cardId)
.filter(v => !!v),
const ret = ReactiveCache.getCards(
{
_id: {
$in: activities()
.map(v => v.cardId)
.filter(v => !!v),
},
},
});
{},
true,
);
return ret;
});