summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-10-14 00:18:20 +0300
committerLauri Ojansivu <x@xet7.org>2018-10-14 00:18:20 +0300
commit9faa85a1c3b886d9e23e29148d1cbbfa7c214d51 (patch)
treedde915901134f01c386a994d0ff78b225ccd6057
parentcb98b1326dc192238e6b50304e6043e122bde4ac (diff)
downloadwekan-9faa85a1c3b886d9e23e29148d1cbbfa7c214d51.tar.gz
wekan-9faa85a1c3b886d9e23e29148d1cbbfa7c214d51.tar.bz2
wekan-9faa85a1c3b886d9e23e29148d1cbbfa7c214d51.zip
- [REST API: Get cards by swimlane id](https://github.com/wekan/wekan/pull/1944). Please [add docs](https://github.com/wekan/wekan/wiki/REST-API-Swimlanes).
Thanks to dcmcand ! Closes #1934
-rw-r--r--models/cards.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js
index 73b9a023..7a0bcd5c 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -1056,6 +1056,29 @@ if (Meteor.isServer) {
cardRemover(userId, doc);
});
}
+//SWIMLANES REST API
+if (Meteor.isServer) {
+ JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes/:swimlaneId/cards', function(req, res) {
+ const paramBoardId = req.params.boardId;
+ const paramSwimlaneId = req.params.swimlaneId;
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
+ JsonRoutes.sendResult(res, {
+ code: 200,
+ data: Cards.find({
+ boardId: paramBoardId,
+ swimlaneId: paramSwimlaneId,
+ archived: false,
+ }).map(function(doc) {
+ return {
+ _id: doc._id,
+ title: doc.title,
+ description: doc.description,
+ listId: doc.listId,
+ };
+ }),
+ });
+ });
+}
//LISTS REST API
if (Meteor.isServer) {
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function (req, res) {