mirror of
https://github.com/wekan/wekan.git
synced 2026-01-28 04:06:10 +01:00
Add new rules report
This commit is contained in:
parent
4aee129cdc
commit
1d4a65d0b4
4 changed files with 108 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
|||
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);
|
||||
return Rules.find({
|
||||
|
|
@ -16,3 +21,23 @@ Meteor.publish('allTriggers', () => {
|
|||
Meteor.publish('allActions', () => {
|
||||
return Actions.find({});
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
return [
|
||||
rules,
|
||||
Actions.find({ _id: { $in: actionIds } }),
|
||||
Triggers.find({ _id: { $in: triggerIds } }),
|
||||
Boards.find({ _id: { $in: boardIds } }, { fields: { title: 1 } }),
|
||||
];
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue