summaryrefslogtreecommitdiffstats
path: root/models/boards.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-23 23:07:54 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commit60be4df76e02afdf4dd62f8e03505d55c0ed119e (patch)
tree73d22fb7d30eb738ffd876762f1a20f28ce623a2 /models/boards.js
parentf888cfd565b197903c24a07221f6a6a44e1b6223 (diff)
downloadwekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.tar.gz
wekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.tar.bz2
wekan-60be4df76e02afdf4dd62f8e03505d55c0ed119e.zip
Allow swimlane creation from template
Mix lists with same name to avoid duplicates
Diffstat (limited to 'models/boards.js')
-rw-r--r--models/boards.js24
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));