StackApiController added the update put route.
Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
committed by
Julius Härtl
parent
cec06493c0
commit
be91ff641c
@@ -86,6 +86,7 @@ return [
|
||||
|
||||
['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'],
|
||||
['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'POST'],
|
||||
['name' => 'stack_api#update', 'url' => '/api/v1.0/board/{boardId}/stacks/{id}', 'verb' => 'PUT'],
|
||||
['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stacks/{id}', 'verb' => 'DELETE'],
|
||||
|
||||
['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}',
|
||||
|
||||
@@ -81,11 +81,34 @@ class StackApiController extends ApiController {
|
||||
public function create($boardId, $title, $order) {
|
||||
|
||||
try {
|
||||
// this throws a StatusException that needs to be caught and handled
|
||||
$stack = $this->service->create($title, $boardId, $order);
|
||||
} catch (StatusException $e) {
|
||||
$errorMessage['error'] = $e->getMessage();
|
||||
return new DataResponse($errorMessage, Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
return new DataResponse($errorMessage, HTTP::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
return new DataResponse($stack, HTTP::STATUS_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @CORS
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @params $stackId
|
||||
* @params $title
|
||||
* @params $boardId
|
||||
* @params $order
|
||||
*
|
||||
* Create a stack with the specified title and order.
|
||||
*/
|
||||
public function update($stackId, $title, $boardId, $order) {
|
||||
|
||||
try {
|
||||
$stack = $this->service->update($stackId, $title, $boardId, $order);
|
||||
} catch (StatusException $e) {
|
||||
$errorMessage['error'] = $e->getMessage();
|
||||
return new DataResponse($errorMessage, HTTP::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
return new DataResponse($stack, HTTP::STATUS_OK);
|
||||
|
||||
Reference in New Issue
Block a user