Allow to set duedate during card creation

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-03-29 12:37:04 +02:00
parent fdfbcb6535
commit 1781aaafb7
3 changed files with 6 additions and 3 deletions

View File

@@ -515,6 +515,8 @@ The board list endpoint supports setting an `If-Modified-Since` header to limit
| title | String | The title of the new stack | | title | String | The title of the new stack |
| type | String | Type of the card (for later use) use 'plain' for now | | type | String | Type of the card (for later use) use 'plain' for now |
| order | Integer | Order for sorting the stacks | | order | Integer | Order for sorting the stacks |
| description | String | _(optional)_ The markdown description of the card |
| duedate | timestamp | _(optional)_ The duedate of the card or null |
#### Response #### Response

View File

@@ -76,8 +76,8 @@ class CardApiController extends ApiController {
* *
* Get a specific card. * Get a specific card.
*/ */
public function create($title, $type = 'plain', $order = 999, $description = '') { public function create($title, $type = 'plain', $order = 999, $description = '', $duedate = null) {
$card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId, $description); $card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId, $description, $duedate);
return new DataResponse($card, HTTP::STATUS_OK); return new DataResponse($card, HTTP::STATUS_OK);
} }

View File

@@ -158,7 +158,7 @@ class CardService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
* @throws BadrequestException * @throws BadrequestException
*/ */
public function create($title, $stackId, $type, $order, $owner, $description = '') { public function create($title, $stackId, $type, $order, $owner, $description = '', $duedate = null) {
if ($title === 'false' || $title === null) { if ($title === 'false' || $title === null) {
throw new BadRequestException('title must be provided'); throw new BadRequestException('title must be provided');
} }
@@ -190,6 +190,7 @@ class CardService {
$card->setOrder($order); $card->setOrder($order);
$card->setOwner($owner); $card->setOwner($owner);
$card->setDescription($description); $card->setDescription($description);
$card->setDuedate($duedate);
$card = $this->cardMapper->insert($card); $card = $this->cardMapper->insert($card);
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_CREATE); $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_CREATE);
$this->changeHelper->cardChanged($card->getId(), false); $this->changeHelper->cardChanged($card->getId(), false);