Files
deck/controller/cardcontroller.php
2016-08-16 13:53:50 +02:00

111 lines
3.2 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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 rename($cardId, $title) {
return $this->cardService->rename($cardId, $title);
}
/**
* @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, $description) {
return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId);
}
/**
* @NoAdminRequired
*/
public function delete($cardId) {
return $this->cardService->delete($this->userId, $cardId);
}
/**
* @NoAdminRequired
*/
public function archive($cardId) {
return $this->cardService->archive($cardId);
}
/**
* @NoAdminRequired
*/
public function unarchive($cardId) {
return $this->cardService->unarchive($cardId);
}
/**
* @NoAdminRequired
*/
public function assignLabel($cardId, $labelId) {
return $this->cardService->assignLabel($this->userId, $cardId, $labelId);
}
/**
* @NoAdminRequired
*/
public function removeLabel($cardId, $labelId) {
return $this->cardService->removeLabel($this->userId, $cardId, $labelId);
}
}