mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
Move every Checklists.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/)
This commit is contained in:
parent
6fd3c0fa6b
commit
e5359dc838
5 changed files with 10 additions and 13 deletions
|
|
@ -8,7 +8,6 @@ import {
|
||||||
} from '../config/const';
|
} from '../config/const';
|
||||||
import Attachments, { fileStoreStrategyFactory } from "./attachments";
|
import Attachments, { fileStoreStrategyFactory } from "./attachments";
|
||||||
import { copyFile } from './lib/fileStoreStrategy.js';
|
import { copyFile } from './lib/fileStoreStrategy.js';
|
||||||
import { DataCache } from 'meteor-reactive-cache';
|
|
||||||
|
|
||||||
Cards = new Mongo.Collection('cards');
|
Cards = new Mongo.Collection('cards');
|
||||||
|
|
||||||
|
|
@ -595,7 +594,7 @@ Cards.helpers({
|
||||||
});
|
});
|
||||||
|
|
||||||
// copy checklists
|
// copy checklists
|
||||||
Checklists.find({ cardId: oldId }).forEach(ch => {
|
ReactiveCache.getChecklists({ cardId: oldId }).forEach(ch => {
|
||||||
ch.copy(_id);
|
ch.copy(_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -811,10 +810,8 @@ Cards.helpers({
|
||||||
},
|
},
|
||||||
|
|
||||||
checklists() {
|
checklists() {
|
||||||
if (!this._checklists) {
|
const ret = ReactiveCache.getChecklists({ cardId: this.getRealId() }, { sort: { sort: 1 } });
|
||||||
this._checklists = new DataCache(() => Checklists.find({ cardId: this.getRealId() }, { sort: { sort: 1 } }).fetch(), 1000);
|
return ret;
|
||||||
}
|
|
||||||
return this._checklists.get();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
firstChecklist() {
|
firstChecklist() {
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ if (Meteor.isServer) {
|
||||||
const paramBoardId = req.params.boardId;
|
const paramBoardId = req.params.boardId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
const checklists = Checklists.find({ cardId: paramCardId }).map(function(
|
const checklists = ReactiveCache.getChecklists({ cardId: paramCardId }).map(function(
|
||||||
doc,
|
doc,
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,9 @@ export class Exporter {
|
||||||
result.actions = [];
|
result.actions = [];
|
||||||
result.cards.forEach((card) => {
|
result.cards.forEach((card) => {
|
||||||
result.checklists.push(
|
result.checklists.push(
|
||||||
...Checklists.find({
|
...ReactiveCache.getChecklists({
|
||||||
cardId: card._id,
|
cardId: card._id,
|
||||||
}).fetch(),
|
}),
|
||||||
);
|
);
|
||||||
result.checklistItems.push(
|
result.checklistItems.push(
|
||||||
...ReactiveCache.getChecklistItems({
|
...ReactiveCache.getChecklistItems({
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ class ExporterCardPDF {
|
||||||
result.actions = [];
|
result.actions = [];
|
||||||
result.cards.forEach((card) => {
|
result.cards.forEach((card) => {
|
||||||
result.checklists.push(
|
result.checklists.push(
|
||||||
...Checklists.find({
|
...ReactiveCache.getChecklists({
|
||||||
cardId: card._id,
|
cardId: card._id,
|
||||||
}).fetch(),
|
}),
|
||||||
);
|
);
|
||||||
result.checklistItems.push(
|
result.checklistItems.push(
|
||||||
...ReactiveCache.getChecklistItems({
|
...ReactiveCache.getChecklistItems({
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,9 @@ class ExporterExcel {
|
||||||
result.actions = [];
|
result.actions = [];
|
||||||
result.cards.forEach((card) => {
|
result.cards.forEach((card) => {
|
||||||
result.checklists.push(
|
result.checklists.push(
|
||||||
...Checklists.find({
|
...ReactiveCache.getChecklists({
|
||||||
cardId: card._id,
|
cardId: card._id,
|
||||||
}).fetch(),
|
}),
|
||||||
);
|
);
|
||||||
result.checklistItems.push(
|
result.checklistItems.push(
|
||||||
...ReactiveCache.getChecklistItems({
|
...ReactiveCache.getChecklistItems({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue