Merge pull request #1648 from nextcloud/bugfix/1430/duedate-create

Allow to set duedate during card creation
This commit is contained in:
Julius Härtl
2020-03-31 14:26:12 +02:00
committed by GitHub
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 |
| type | String | Type of the card (for later use) use 'plain' for now |
| 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

View File

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

View File

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