Move every Swimlanes.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/)

This commit is contained in:
Martin Filser 2023-02-22 22:21:42 +01:00
parent 9125ab440d
commit 33a8de7bb5
6 changed files with 12 additions and 12 deletions

View file

@ -471,7 +471,7 @@ BlazeComponent.extendComponent({
sort: { sort: 1 },
});
if (swimlanes.length)
this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id);
this.selectedSwimlaneId.set(swimlanes[0]._id);
return swimlanes;
},

View file

@ -638,7 +638,7 @@ Boards.helpers({
const _id = Boards.insert(this);
// Copy all swimlanes in board
Swimlanes.find({
ReactiveCache.getSwimlanes({
boardId: oldId,
archived: false,
}).forEach(swimlane => {
@ -777,7 +777,7 @@ Boards.helpers({
},
swimlanes() {
return Swimlanes.find(
return ReactiveCache.getSwimlanes(
{ boardId: this._id, archived: false },
{ sort: { sort: 1 } },
);
@ -798,7 +798,7 @@ Boards.helpers({
},
nullSortSwimlanes() {
return Swimlanes.find({
return ReactiveCache.getSwimlanes({
boardId: this._id,
archived: false,
sort: { $eq: null },
@ -1031,7 +1031,7 @@ Boards.helpers({
query.$or = [{ title: regex }, { description: regex }];
}
return Swimlanes.find(query, projection);
return ReactiveCache.getSwimlanes(query, projection);
},
searchLists(term) {

View file

@ -99,7 +99,7 @@ export class Exporter {
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
result.swimlanes = Swimlanes.find(byBoard, noBoardId).fetch();
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
result.customFields = CustomFields.find(
{ boardIds: this._boardId },
{ fields: { boardIds: 0 } },

View file

@ -42,7 +42,7 @@ class ExporterCardPDF {
);
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
result.swimlanes = Swimlanes.find(byBoard, noBoardId).fetch();
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
result.customFields = CustomFields.find(
{
boardIds: {

View file

@ -44,7 +44,7 @@ class ExporterExcel {
);
result.lists = ReactiveCache.getLists(byBoard, noBoardId);
result.cards = ReactiveCache.getCards(byBoardNoLinked, noBoardId);
result.swimlanes = Swimlanes.find(byBoard, noBoardId).fetch();
result.swimlanes = ReactiveCache.getSwimlanes(byBoard, noBoardId);
result.customFields = CustomFields.find(
{
boardIds: {

View file

@ -305,7 +305,7 @@ Swimlanes.mutations({
});
Swimlanes.userArchivedSwimlanes = userId => {
return Swimlanes.find({
return ReactiveCache.getSwimlanes({
boardId: { $in: Boards.userBoardIds(userId, null) },
archived: true,
})
@ -316,7 +316,7 @@ Swimlanes.userArchivedSwimlaneIds = () => {
};
Swimlanes.archivedSwimlanes = () => {
return Swimlanes.find({ archived: true });
return ReactiveCache.getSwimlanes({ archived: true });
};
Swimlanes.archivedSwimlaneIds = () => {
@ -402,7 +402,7 @@ if (Meteor.isServer) {
JsonRoutes.sendResult(res, {
code: 200,
data: Swimlanes.find({ boardId: paramBoardId, archived: false }).map(
data: ReactiveCache.getSwimlanes({ boardId: paramBoardId, archived: false }).map(
function(doc) {
return {
_id: doc._id,
@ -471,7 +471,7 @@ if (Meteor.isServer) {
const id = Swimlanes.insert({
title: req.body.title,
boardId: paramBoardId,
sort: board.swimlanes().count(),
sort: board.swimlanes().length,
});
JsonRoutes.sendResult(res, {
code: 200,