StackApiController added the update put route.

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-12 21:11:40 -04:00
committed by Julius Härtl
parent cec06493c0
commit be91ff641c
2 changed files with 27 additions and 3 deletions

View File

@@ -80,12 +80,35 @@ class StackApiController extends ApiController {
*/
public function create($boardId, $title, $order) {
try {
// this throws a StatusException that needs to be caught and handled
try {
$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);