Delete boards via the API.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Steven R. Baker
2017-07-29 02:06:26 +02:00
committed by Julius Härtl
parent 0c266d4a1f
commit 7dcd49c485
2 changed files with 14 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ return [
// api
['name' => 'board_api#index', 'url' => '/api/v0.1/boards', 'verb' => 'GET'],
['name' => 'board_api#get', 'url' => '/api/v0.1/board/{id}', 'verb' => 'GET'],
['name' => 'board_api#delete', 'url' => '/api/v0.1/board/{id}', 'verb' => 'DELETE'],
['name' => 'board_api#preflighted_cors', 'url' => '/api/0.1/{path}',
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']],

View File

@@ -73,6 +73,19 @@ class BoardApiController extends ApiController {
public function get($id) {
$board = $this->service->find($id);
// FIXME: this should probably 404 if the board has been deleted
return (new DataResponse($board));
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*/
public function delete($id) {
$board = $this->service->delete($id);
return (new DataResponse($board));
}