The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
wekan/server/publications/rules.js

48 lines
1.0 KiB

import Boards from '/models/boards';
import Actions from '/models/actions';
import Triggers from '/models/triggers';
import Rules from '/models/rules';
Meteor.publish('rules', ruleId => {
check(ruleId, String);
const ret = Rules.find({
_id: ruleId,
});
return ret;
});
Meteor.publish('allRules', () => {
const ret = Rules.find({});
return ret;
});
Meteor.publish('allTriggers', () => {
const ret = Triggers.find({});
return ret;
});
Meteor.publish('allActions', () => {
const ret = Actions.find({});
return ret;
});
Meteor.publish('rulesReport', () => {
const rules = Rules.find();
const actionIds = [];
const triggerIds = [];
const boardIds = [];
rules.forEach(rule => {
actionIds.push(rule.actionId);
triggerIds.push(rule.triggerId);
boardIds.push(rule.boardId);
});
const ret = [
rules,
Actions.find({ _id: { $in: actionIds } }),
Triggers.find({ _id: { $in: triggerIds } }),
ReactiveCache.getBoards({ _id: { $in: boardIds } }, { fields: { title: 1 } }, true),
];
return ret;
});