diff --git a/lib/Controller/CardApiController.php b/lib/Controller/CardApiController.php index 7e7d26eb3..2c598189d 100644 --- a/lib/Controller/CardApiController.php +++ b/lib/Controller/CardApiController.php @@ -2,6 +2,8 @@ /** * @copyright Copyright (c) 2018 Ryan Fletcher * + * @copyright Copyright (c) 2019, Alexandru Puiu (alexpuiu20@yahoo.com) + * * @author Ryan Fletcher * * @license GNU AGPL version 3 or any later version @@ -70,11 +72,12 @@ class CardApiController extends ApiController { * @params $title * @params $type * @params $order + * @params $description * * Get a specific card. */ - public function create($title, $type = 'plain', $order = 999) { - $card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId); + public function create($title, $type = 'plain', $order = 999, $description = '') { + $card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId, $description); return new DataResponse($card, HTTP::STATUS_OK); } diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php index 249364f0c..bc1cdf207 100644 --- a/lib/Service/CardService.php +++ b/lib/Service/CardService.php @@ -2,6 +2,8 @@ /** * @copyright Copyright (c) 2016 Julius Härtl * + * @copyright Copyright (c) 2019, Alexandru Puiu (alexpuiu20@yahoo.com) + * * @author Julius Härtl * @author Maxence Lange * @@ -147,6 +149,7 @@ class CardService { * @param $stackId * @param $type * @param integer $order + * @param $description * @param $owner * @return \OCP\AppFramework\Db\Entity * @throws StatusException @@ -155,8 +158,7 @@ class CardService { * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws BadrequestException */ - public function create($title, $stackId, $type, $order, $owner) { - + public function create($title, $stackId, $type, $order, $owner, $description = '') { if ($title === 'false' || $title === null) { throw new BadRequestException('title must be provided'); } @@ -187,6 +189,7 @@ class CardService { $card->setType($type); $card->setOrder($order); $card->setOwner($owner); + $card->setDescription($description); $card = $this->cardMapper->insert($card); $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_CREATE); $this->changeHelper->cardChanged($card->getId(), false);