Finish base API.
Making PR, any additional API functions or modifications can be done within the repository now.
This commit is contained in:
parent
77e3744b40
commit
ac65d5fa21
8 changed files with 249 additions and 6 deletions
|
@ -40,7 +40,7 @@ class NodeController extends BaseController
|
|||
*/
|
||||
public function getNodes(Request $request)
|
||||
{
|
||||
$nodes = Models\Node::paginate(15);
|
||||
$nodes = Models\Node::paginate(50);
|
||||
return $this->response->paginator($nodes, new NodeTransformer);
|
||||
}
|
||||
|
||||
|
@ -151,4 +151,27 @@ class NodeController extends BaseController
|
|||
return $allocations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Node
|
||||
*
|
||||
* @Delete("/nodes/{id}")
|
||||
* @Versions({"v1"})
|
||||
* @Parameters({
|
||||
* @Parameter("id", type="integer", required=true, description="The ID of the node."),
|
||||
* })
|
||||
* @Response(204)
|
||||
*/
|
||||
public function deleteNode(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$node = new NodeRepository;
|
||||
$node->delete($id);
|
||||
return $this->response->noContent();
|
||||
} catch (DisplayException $ex) {
|
||||
throw new ResourceException($ex->getMessage());
|
||||
} catch(\Exception $e) {
|
||||
throw new ServiceUnavailableHttpException('An error occured while attempting to delete this node.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue