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 }, sort: { sort: 1 },
}); });
if (swimlanes.length) if (swimlanes.length)
this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id); this.selectedSwimlaneId.set(swimlanes[0]._id);
return swimlanes; return swimlanes;
}, },

View file

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

View file

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

View file

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

View file

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

View file

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