mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
add restore to api
This commit is contained in:
parent
36d7b0f8a7
commit
5ff9bf331f
1 changed files with 38 additions and 0 deletions
|
|
@ -4479,6 +4479,44 @@ JsonRoutes.add('GET', '/api/boards/:boardId/cards_count', function(
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @operation restore_card
|
||||||
|
* @summary Restore a card from the archive
|
||||||
|
*
|
||||||
|
* @description Restore a card from the archive
|
||||||
|
* @param {string} boardId the board ID of the card
|
||||||
|
* @param {string} listId the list ID of the card
|
||||||
|
* @param {string} cardId the ID of the card
|
||||||
|
* @return_type {_id: string, archived: boolean}
|
||||||
|
*/
|
||||||
|
JsonRoutes.add(
|
||||||
|
'POST',
|
||||||
|
'/api/boards/:boardId/lists/:listId/cards/:cardId/restore',
|
||||||
|
function(req, res) {
|
||||||
|
const paramBoardId = req.params.boardId;
|
||||||
|
const paramCardId = req.params.cardId;
|
||||||
|
const paramListId = req.params.listId;
|
||||||
|
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||||
|
const card = ReactiveCache.getCard({
|
||||||
|
_id: paramCardId,
|
||||||
|
listId: paramListId,
|
||||||
|
boardId: paramBoardId,
|
||||||
|
archived: true,
|
||||||
|
});
|
||||||
|
if (!card) {
|
||||||
|
throw new Meteor.Error(404, 'Card not found');
|
||||||
|
}
|
||||||
|
card.restore();
|
||||||
|
JsonRoutes.sendResult(res, {
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
_id: paramCardId,
|
||||||
|
archived: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position history tracking methods
|
// Position history tracking methods
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue