diff options
Diffstat (limited to 'models/boards.js')
-rw-r--r-- | models/boards.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js index 530a6f71..d81ded15 100644 --- a/models/boards.js +++ b/models/boards.js @@ -463,6 +463,30 @@ Boards.helpers({ return _id; }, + searchSwimlanes(term) { + check(term, Match.OneOf(String, null, undefined)); + + const query = { boardId: this._id }; + if (this.isTemplatesBoard()) { + query.type = 'template-swimlane'; + query.archived = false; + } else { + query.type = {$nin: ['template-swimlane']}; + } + const projection = { limit: 10, sort: { createdAt: -1 } }; + + if (term) { + const regex = new RegExp(term, 'i'); + + query.$or = [ + { title: regex }, + { description: regex }, + ]; + } + + return Swimlanes.find(query, projection); + }, + searchLists(term) { check(term, Match.OneOf(String, null, undefined)); |