Added checks to see if the entity is not found in BoardApiController -> get($id)

Signed-off-by: Ryan Fletcher <ryan.fletcher@codepassion.ca>
This commit is contained in:
Ryan Fletcher
2018-07-12 16:11:30 -04:00
committed by Julius Härtl
parent 8771e35f11
commit 9bc9569a0d
2 changed files with 11 additions and 6 deletions

View File

@@ -24,6 +24,7 @@
namespace OCA\Deck\Controller;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCP\IUserManager;
@@ -74,10 +75,14 @@ class BoardApiController extends ApiController {
*
* Return the board specified by $id.
*/
public function get($id) {
public function get($id) {
$board = $this->service->find($id);
if ($board === false || $board === null) {
return new DataResponse('Board not found', HTTP::STATUS_NOT_FOUND);
}
return new DataResponse($board);
return new DataResponse($board, HTTP::STATUS_OK);
}
/**