mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Merge pull request #5090 from DimDz/master
Move card to other boards API
This commit is contained in:
commit
b03ea37944
1 changed files with 31 additions and 0 deletions
|
@ -3499,6 +3499,9 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
|||
const paramBoardId = req.params.boardId;
|
||||
const paramCardId = req.params.cardId;
|
||||
const paramListId = req.params.listId;
|
||||
const newBoardId = req.body.newBoardId;
|
||||
const newSwimlaneId = req.body.newSwimlaneId;
|
||||
const newListId = req.body.newListId;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
|
||||
if (req.body.title) {
|
||||
|
@ -3827,6 +3830,34 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
|||
paramListId,
|
||||
);
|
||||
}
|
||||
if (newBoardId && newSwimlaneId && newListId) {
|
||||
// Move the card to the new board, swimlane, and list
|
||||
Cards.direct.update(
|
||||
{
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
},
|
||||
{
|
||||
$set: {
|
||||
boardId: newBoardId,
|
||||
swimlaneId: newSwimlaneId,
|
||||
listId: newListId,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const card = ReactiveCache.getCard(paramCardId);
|
||||
cardMove(
|
||||
req.userId,
|
||||
card,
|
||||
['boardId', 'swimlaneId', 'listId'],
|
||||
newListId,
|
||||
newSwimlaneId,
|
||||
newBoardId,
|
||||
);
|
||||
}
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue