mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04:00
Merge branch 'zarnifoulette-devel' into devel
REST API: Add PUT method to update a card. Thanks to zarnifoulette ! Related to #1037
This commit is contained in:
commit
e8a661e0ea
2 changed files with 37 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue