This commit is contained in:
Julius Haertl
2016-06-15 14:05:19 +02:00
parent ae9d5da329
commit cf3bbcb888
35 changed files with 686 additions and 465 deletions

View File

@@ -1,5 +1,6 @@
<?php
// TODO: Implement LATER
namespace OCA\Deck\Controller;
use OCA\Deck\Service\BoardService;
@@ -13,11 +14,11 @@ class BoardApiController extends BaseApiController {
private $userId;
public function __construct($appName,
IRequest $request,
BoardService $stackService,
BoardService $cardService,
$userId){
parent::__construct($appName, $request);
$this->userId = $userId;
$this->boardService = $stackService;
$this->boardService = $cardService;
}
/**
* @NoAdminRequired

View File

@@ -14,11 +14,11 @@ class BoardController extends Controller {
private $boardService;
public function __construct($appName,
IRequest $request,
BoardService $stackService,
BoardService $cardService,
$userId){
parent::__construct($appName, $request);
$this->userId = $userId;
$this->boardService = $stackService;
$this->boardService = $cardService;
}
/**
* @NoAdminRequired
@@ -32,7 +32,7 @@ class BoardController extends Controller {
*/
public function read($boardId) {
// FIXME: Remove as this is just for testing if loading animation works out nicely
usleep(500000);
usleep(200000);
return $this->boardService->find($this->userId, $boardId);
}
/**

View File

@@ -0,0 +1,57 @@
<?php
namespace OCA\Deck\Controller;
use OCA\Deck\Service\CardService;
use OCP\IRequest;
use OCP\AppFramework\Controller;
class CardController extends Controller {
private $userId;
private $cardService;
public function __construct($appName,
IRequest $request,
CardService $cardService,
$userId){
parent::__construct($appName, $request);
$this->userId = $userId;
$this->cardService = $cardService;
}
/**
* @NoAdminRequired
*/
public function index($cardId) {
return $this->cardService->findAll($boardId);
}
/**
* @NoAdminRequired
*/
public function read($cardId) {
return $this->cardService->find($this->userId, $cardId);
}
/**
* @NoAdminRequired
*/
public function reorder($cardId, $stackId, $order) {
return $this->cardService->reorder($cardId, $stackId, $order);
}
/**
* @NoAdminRequired
*/
public function create($title, $stackId, $type, $order=999) {
return $this->cardService->create($title, $stackId, $type, $order, $this->userId);
}
/**
* @NoAdminRequired
*/
public function update($id, $title, $stackId, $type, $order) {
return $this->cardService->update($id, $title, $stackId, $type, $order, $this->userId);
}
/**
* @NoAdminRequired
*/
public function delete($cardId) {
return $this->cardService->delete($this->userId, $cardId);
}
}

View File

@@ -27,27 +27,15 @@ class PageController extends Controller {
}
/**
* CAUTION: the @Stuff turns off security checks; for this page no admin is
* required and no CSRF check. If you don't know what CSRF is, read
* it up in the docs or you might create a security hole. This is
* basically the only required method to add this exemption, don't
* add it to any other method if you don't exactly know what it does
* Handle main html view from templates/main.php
* This will return the main angular application
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
$params = ['user' => $this->userId];
return new TemplateResponse('deck', 'main', $params); // templates/main.php
return new TemplateResponse('deck', 'main', $params);
}
/**
* Simply method that posts back the payload of the request
* @NoAdminRequired
*/
public function doEcho($echo) {
return new DataResponse(['echo' => $echo]);
}
}

View File

@@ -14,11 +14,11 @@ class StackController extends Controller {
private $stackService;
public function __construct($appName,
IRequest $request,
StackService $stackService,
StackService $cardService,
$userId){
parent::__construct($appName, $request);
$this->userId = $userId;
$this->stackService = $stackService;
$this->stackService = $cardService;
}
/**
* @NoAdminRequired