summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-06-29 15:55:11 +0300
committerLauri Ojansivu <x@xet7.org>2017-06-29 15:55:11 +0300
commite8a661e0ea6c33978adf204674caa7ab40a0b3fb (patch)
tree34a0326f256d5736325485249d90dbbd17452321
parent1e525235054d6cbc1a742ca079abbdeac7299e53 (diff)
parent2c1509686d623008a2641b9741de3be7d3e3163a (diff)
downloadwekan-e8a661e0ea6c33978adf204674caa7ab40a0b3fb.tar.gz
wekan-e8a661e0ea6c33978adf204674caa7ab40a0b3fb.tar.bz2
wekan-e8a661e0ea6c33978adf204674caa7ab40a0b3fb.zip
Merge branch 'zarnifoulette-devel' into devel
REST API: Add PUT method to update a card. Thanks to zarnifoulette ! Related to #1037
-rw-r--r--CHANGELOG.md8
-rw-r--r--models/cards.js29
2 files changed, 37 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4e4a3ec..a8bdbbe9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# Upcoming Wekan release
+
+This release adds the following new features:
+
+* [REST API: Add PUT method to update a card](https://github.com/wekan/wekan/pull/1095).
+
+Thanks to GitHub user zarnifoulette for contributions!
+
# v0.27 2017-06-28 Wekan release
This release adds the following new features:
diff --git a/models/cards.js b/models/cards.js
index c48b4845..a48690bf 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -420,6 +420,35 @@ if (Meteor.isServer) {
});
});
+ JsonRoutes.add('PUT', '/api/boards/:boardId/lists/:listId/cards/:cardId', function (req, res, next) {
+ Authentication.checkUserId( req.userId);
+ const paramBoardId = req.params.boardId;
+ const paramCardId = req.params.cardId;
+ const paramListId = req.params.listId;
+ if(req.body.title !== undefined){
+ const newTitle = req.body.title;
+ Cards.update({ _id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false },
+ {$set:{title:newTitle}});
+ }
+ if(req.body.listId !== undefined){
+ const newParamListId = req.body.listId;
+ Cards.update({ _id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false },
+ {$set:{listId:newParamListId}});
+ }
+ if(req.body.description !== undefined){
+ const newDescription = req.body.description;
+ Cards.update({ _id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false },
+ {$set:{description:newDescription}});
+ }
+ JsonRoutes.sendResult(res, {
+ code: 200,
+ data: {
+ _id: paramCardId,
+ },
+ });
+ });
+
+
JsonRoutes.add('DELETE', '/api/boards/:boardId/lists/:listId/cards/:cardId', function (req, res, next) {
Authentication.checkUserId( req.userId);
const paramBoardId = req.params.boardId;