mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
v7.38
This commit is contained in:
parent
1783257c0e
commit
5dd318a481
2 changed files with 57 additions and 1 deletions
|
|
@ -2239,6 +2239,37 @@ if (Meteor.isServer) {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @operation copy_board
|
||||
* @summary Copy a board to a new one
|
||||
*
|
||||
* @description If your are board admin or wekan admin, this copies the
|
||||
* given board to a new one.
|
||||
*
|
||||
* @param {string} boardId the board
|
||||
* @param {string} title the title of the new board (default to old one)
|
||||
*
|
||||
* @return_type string
|
||||
*/
|
||||
JsonRoutes.add('POST', '/api/boards/:boardId/copy', function(req, res) {
|
||||
const id = req.params.boardId;
|
||||
const board = ReactiveCache.getBoard(id);
|
||||
const adminAccess = board.members.some(e => e.userId === req.userId && e.isAdmin);
|
||||
Authentication.checkAdminOrCondition(req.userId, adminAccess);
|
||||
try {
|
||||
board['title'] = req.body.title || Boards.uniqueTitle(board.title);
|
||||
ret = board.copy();
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: ret,
|
||||
});
|
||||
} catch (error) {
|
||||
JsonRoutes.sendResult(res, {
|
||||
data: error,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @operation set_board_member_permission
|
||||
* @tag Users
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue