mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue