Re-format code according to the coding style.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Steven R. Baker
2018-02-12 11:55:02 +01:00
committed by Julius Härtl
parent 40f34eb3bc
commit 8ec97032b1
3 changed files with 150 additions and 150 deletions

View File

@@ -76,18 +76,18 @@ return [
['name' => 'label#update', 'url' => '/labels/{labelId}', 'verb' => 'PUT'],
['name' => 'label#delete', 'url' => '/labels/{labelId}', 'verb' => 'DELETE'],
// api
['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'],
['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'],
['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'],
['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'],
['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'],
// api
['name' => 'board_api#index', 'url' => '/api/v1.0/boards', 'verb' => 'GET'],
['name' => 'board_api#get', 'url' => '/api/v1.0/board/{id}', 'verb' => 'GET'],
['name' => 'board_api#create', 'url' => '/api/v1.0/board', 'verb' => 'POST'],
['name' => 'board_api#delete', 'url' => '/api/v1.0/board/{id}', 'verb' => 'DELETE'],
['name' => 'board_api#undo_delete', 'url' => '/api/v1.0/board/{id}/undo_delete', 'verb' => 'POST'],
['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'],
['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'],
['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'],
['name' => 'stack_api#index', 'url' => '/api/v1.0/board/{boardId}/stacks', 'verb' => 'GET'],
['name' => 'stack_api#create', 'url' => '/api/v1.0/board/{boardId}/stack', 'verb' => 'POST'],
['name' => 'stack_api#delete', 'url' => '/api/v1.0/board/{boardId}/stack/{id}', 'verb' => 'DELETE'],
['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}',
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']],
['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}',
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']],
]
];

View File

@@ -38,109 +38,109 @@ use OCA\Deck\Service\BoardService;
*/
class BoardApiController extends ApiController {
private $service;
private $userInfo;
private $service;
private $userInfo;
/**
* @param string $appName
* @param IRequest $request
* @param IUserManager $userManager
* @param IGroupManager $groupManager
* @param BoardService $service
* @param $userId
*/
public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) {
parent::__construct($appName, $request);
$this->service = $service;
$this->userId = $userId;
$this->userManager = $userManager;
$this->groupManager = $groupManager;
}
/**
* @param string $appName
* @param IRequest $request
* @param IUserManager $userManager
* @param IGroupManager $groupManager
* @param BoardService $service
* @param $userId
*/
public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, BoardService $service, $userId) {
parent::__construct($appName, $request);
$this->service = $service;
$this->userId = $userId;
$this->userManager = $userManager;
$this->groupManager = $groupManager;
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* Return all of the boards that the current user has access to.
*/
public function index() {
$boards = $this->service->findAll($this->getUserInfo());
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* Return all of the boards that the current user has access to.
*/
public function index() {
$boards = $this->service->findAll($this->getUserInfo());
return new DataResponse($boards);
}
return new DataResponse($boards);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Return the board specified by $id.
*/
public function get($id) {
$board = $this->service->find($id);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Return the board specified by $id.
*/
public function get($id) {
$board = $this->service->find($id);
// FIXME: this should probably 404 if the board has been deleted
// FIXME: this should probably 404 if the board has been deleted
return new DataResponse($board);
}
return new DataResponse($board);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $title
* @params $color
*
* Create a board with the specified title and color.
*/
public function create($title, $color) {
$board = $this->service->create($title, $this->userId, $color);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $title
* @params $color
*
* Create a board with the specified title and color.
*/
public function create($title, $color) {
$board = $this->service->create($title, $this->userId, $color);
return new DataResponse($board);
}
return new DataResponse($board);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Delete the board specified by $id. Return the board that was deleted.
*/
public function delete($id) {
$board = $this->service->delete($id);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Delete the board specified by $id. Return the board that was deleted.
*/
public function delete($id) {
$board = $this->service->delete($id);
return new DataResponse($board);
}
return new DataResponse($board);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Undo the deletion of the board specified by $id.
*/
public function undoDelete($id) {
$board = $this->service->find($id);
$this->service->deleteUndo($id);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Undo the deletion of the board specified by $id.
*/
public function undoDelete($id) {
$board = $this->service->find($id);
$this->service->deleteUndo($id);
return new DataResponse($board);
}
return new DataResponse($board);
}
// this is taken from BoardController, but it's not ideal
private function getUserInfo() {
$groups = $this->groupManager->getUserGroupIds(
// this is taken from BoardController, but it's not ideal
private function getUserInfo() {
$groups = $this->groupManager->getUserGroupIds(
$this->userManager->get($this->userId)
);
return ['user' => $this->userId,
'groups' => $groups];
}
return ['user' => $this->userId,
'groups' => $groups];
}
}

View File

@@ -36,62 +36,62 @@ use OCA\Deck\Service\StackService;
*/
class StackApiController extends ApiController {
private $service;
private $userInfo;
private $service;
private $userInfo;
/**
* @param string $appName
* @param IRequest $request
* @param StackService $service
*/
public function __construct($appName, IRequest $request, StackService $service) {
parent::__construct($appName, $request);
$this->service = $service;
}
/**
* @param string $appName
* @param IRequest $request
* @param StackService $service
*/
public function __construct($appName, IRequest $request, StackService $service) {
parent::__construct($appName, $request);
$this->service = $service;
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* Return all of the stacks in the specified board.
*/
public function index($boardId) {
$stacks = $this->service->findAll($boardId);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* Return all of the stacks in the specified board.
*/
public function index($boardId) {
$stacks = $this->service->findAll($boardId);
return new DataResponse($stacks);
}
return new DataResponse($stacks);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $title
* @params $order
*
* Create a stack with the specified title and order.
*/
public function create($boardId, $title, $order) {
// this throws a StatusException that needs to be caught and handled
$stack = $this->service->create($title, $boardId, $order);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $title
* @params $order
*
* Create a stack with the specified title and order.
*/
public function create($boardId, $title, $order) {
// this throws a StatusException that needs to be caught and handled
$stack = $this->service->create($title, $boardId, $order);
return new DataResponse($stack);
}
return new DataResponse($stack);
}
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Delete the stack specified by $id. Return the board that was deleted.
*/
public function delete($boardId, $id) {
$stack = $this->service->delete($id);
/**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
* @params $id
*
* Delete the stack specified by $id. Return the board that was deleted.
*/
public function delete($boardId, $id) {
$stack = $this->service->delete($id);
return new DataResponse($stack);
}
return new DataResponse($stack);
}
}