Initial COmmit WIP
This commit is contained in:
23
controller/apicontroller.php
Normal file
23
controller/apicontroller.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\ApiController as BaseApiController;
|
||||
|
||||
class ApiController extends BaseApiController {
|
||||
public function __construct($appName,
|
||||
IRequest $request){
|
||||
parent::__construct($appName, $request);
|
||||
}
|
||||
/**
|
||||
* @PublicPage
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*/
|
||||
public function index() {
|
||||
return [
|
||||
'apiLevels' => ['v1']
|
||||
];
|
||||
}
|
||||
}
|
||||
54
controller/boardapicontroller.php
Normal file
54
controller/boardapicontroller.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCA\Deck\Service\BoardService;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
|
||||
use OCP\AppFramework\ApiController as BaseApiController;
|
||||
|
||||
class BoardApiController extends BaseApiController {
|
||||
private $userId;
|
||||
public function __construct($appName,
|
||||
IRequest $request,
|
||||
BoardService $stackService,
|
||||
$userId){
|
||||
parent::__construct($appName, $request);
|
||||
$this->userId = $userId;
|
||||
$this->boardService = $stackService;
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*/
|
||||
public function index() {
|
||||
return new DataResponse($this->boardService->findAll($this->userId));
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*/
|
||||
public function create($title, $color) {
|
||||
return new DataResponse($this->boardService->create($title, $this->userId, $color));
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*/
|
||||
public function update($id, $title, $color) {
|
||||
return new DataResponse($this->boardService->create($title, $this->userId, $color));
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*/
|
||||
public function delete($id) {
|
||||
return new DataResponse($this->boardService->create($title, $this->userId, $color));
|
||||
}
|
||||
}
|
||||
56
controller/boardcontroller.php
Normal file
56
controller/boardcontroller.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCA\Deck\Service\BoardService;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
class BoardController extends Controller {
|
||||
private $userId;
|
||||
private $boardService;
|
||||
public function __construct($appName,
|
||||
IRequest $request,
|
||||
BoardService $stackService,
|
||||
$userId){
|
||||
parent::__construct($appName, $request);
|
||||
$this->userId = $userId;
|
||||
$this->boardService = $stackService;
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
return $this->boardService->findAll($this->userId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function read($boardId) {
|
||||
// FIXME: Remove as this is just for testing if loading animation works out nicely
|
||||
usleep(500000);
|
||||
return $this->boardService->find($this->userId, $boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function create($title, $color) {
|
||||
return $this->boardService->create($title, $this->userId, $color);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function update($id, $title, $color) {
|
||||
return $this->boardService->update($id, $title, $this->userId, $color);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function delete($boardId) {
|
||||
return $this->boardService->delete($this->userId, $boardId);
|
||||
}
|
||||
}
|
||||
53
controller/pagecontroller.php
Normal file
53
controller/pagecontroller.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - deck
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
* @copyright Julius Härtl 2016
|
||||
*/
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
|
||||
class PageController extends Controller {
|
||||
|
||||
|
||||
private $userId;
|
||||
|
||||
public function __construct($AppName, IRequest $request, $UserId){
|
||||
parent::__construct($AppName, $request);
|
||||
$this->userId = $UserId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function index() {
|
||||
$params = ['user' => $this->userId];
|
||||
return new TemplateResponse('deck', 'main', $params); // templates/main.php
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply method that posts back the payload of the request
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function doEcho($echo) {
|
||||
return new DataResponse(['echo' => $echo]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
53
controller/stackcontroller.php
Normal file
53
controller/stackcontroller.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCA\Deck\Service\StackService;
|
||||
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
class StackController extends Controller {
|
||||
private $userId;
|
||||
private $stackService;
|
||||
public function __construct($appName,
|
||||
IRequest $request,
|
||||
StackService $stackService,
|
||||
$userId){
|
||||
parent::__construct($appName, $request);
|
||||
$this->userId = $userId;
|
||||
$this->stackService = $stackService;
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function index($boardId) {
|
||||
return $this->stackService->findAll($boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function read($boardId) {
|
||||
return $this->stackService->find($this->userId, $boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function create($title, $boardId, $order=999) {
|
||||
return $this->stackService->create($title, $boardId, $order);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function update($id, $title, $color) {
|
||||
return $this->stackService->update($id, $title, $this->userId, $color);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function delete($boardId) {
|
||||
return $this->stackService->delete($this->userId, $boardId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user