mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02: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 paramBoardId = req.params.boardId;
|
||||||
const paramCardId = req.params.cardId;
|
const paramCardId = req.params.cardId;
|
||||||
const paramListId = req.params.listId;
|
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);
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
|
|
||||||
if (req.body.title) {
|
if (req.body.title) {
|
||||||
|
@ -3827,6 +3830,34 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
||||||
paramListId,
|
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, {
|
JsonRoutes.sendResult(res, {
|
||||||
code: 200,
|
code: 200,
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue