mirror of
https://github.com/wekan/wekan.git
synced 2026-02-01 14:11:48 +01:00
Add methods to models for archived entities
This commit is contained in:
parent
01bd94d2b3
commit
bbcb236a46
5 changed files with 115 additions and 44 deletions
|
|
@ -1208,6 +1208,26 @@ function boardRemover(userId, doc) {
|
|||
);
|
||||
}
|
||||
|
||||
Boards.userBoards = (userId, includeArchived = false, selector = {}) => {
|
||||
if (!includeArchived) {
|
||||
selector = {
|
||||
archived: false,
|
||||
};
|
||||
}
|
||||
selector.$or = [
|
||||
{ permission: 'public' },
|
||||
{ members: { $elemMatch: { userId, isActive: true } } },
|
||||
];
|
||||
|
||||
return Boards.find(selector);
|
||||
};
|
||||
|
||||
Boards.userBoardIds = (userId, includeArchived = false, selector = {}) => {
|
||||
return Boards.userBoards(userId, includeArchived, selector).map(board => {
|
||||
return board._id;
|
||||
});
|
||||
};
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Boards.allow({
|
||||
insert: Meteor.userId,
|
||||
|
|
|
|||
|
|
@ -328,6 +328,16 @@ Lists.mutations({
|
|||
},
|
||||
});
|
||||
|
||||
Lists.archivedLists = () => {
|
||||
return Lists.find({ archived: true });
|
||||
};
|
||||
|
||||
Lists.archivedListIds = () => {
|
||||
return Lists.archivedLists().map(list => {
|
||||
return list._id;
|
||||
});
|
||||
};
|
||||
|
||||
Meteor.methods({
|
||||
applyWipLimit(listId, limit) {
|
||||
check(listId, String);
|
||||
|
|
|
|||
|
|
@ -283,6 +283,16 @@ Swimlanes.mutations({
|
|||
},
|
||||
});
|
||||
|
||||
Swimlanes.archivedSwimlanes = () => {
|
||||
return Swimlanes.find({ archived: true });
|
||||
};
|
||||
|
||||
Swimlanes.archivedSwimlaneIds = () => {
|
||||
return Swimlanes.archivedSwimlanes().map(swim => {
|
||||
return swim._id;
|
||||
});
|
||||
};
|
||||
|
||||
Swimlanes.hookOptions.after.update = { fetchPrevious: false };
|
||||
|
||||
if (Meteor.isServer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue