Implemented StackApiController Get Function.

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-13 19:29:39 -04:00
committed by Julius Härtl
parent dd1d4246fe
commit cfd9ab98c6
3 changed files with 36 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ class StackApiController extends ApiController {
* Return all of the stacks in the specified board.
*/
public function index() {
$boardError = $this->apiHelper->entityHasError( $this->request->params['boardId'], 'board', $this->boardService );
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
@@ -81,8 +81,29 @@ class StackApiController extends ApiController {
return new DataResponse($stacks, HTTP::STATUS_OK);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* Return all of the stacks in the specified board.
*/
public function get() {
$boardError = $this->apiHelper->entityHasError($this->request->params['boardId'], 'board', $this->boardService);
if ($boardError) {
return new DataResponse($boardError['message'], $boardError['status']);
}
$stack = $this->service->find($this->request->params['stackId']);
if ($stack == false || $stack == null) {
return new DataResponse("Stack not found", HTTP::STATUS_NOT_FOUND);
}
return new DataResponse($stack, HTTP::STATUS_OK);
}
/**
* @NoAdminRequired
* @CORS