fix: Allow optional nullable parameters in the API

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2023-11-08 09:13:08 +01:00
parent c405a5729a
commit 27d5861456
3 changed files with 57 additions and 3 deletions

View File

@@ -25,6 +25,7 @@
namespace OCA\Deck\Controller;
use OCA\Deck\Model\OptionalNullableValue;
use OCA\Deck\Service\AssignmentService;
use OCA\Deck\Service\CardService;
use OCP\AppFramework\ApiController;
@@ -104,7 +105,8 @@ class CardApiController extends ApiController {
*
* Update a card
*/
public function update($title, $type, $owner, $description = '', $order = 0, $duedate = null, $archived = null, ?bool $done = null) {
public function update($title, $type, $owner, $description = '', $order = 0, $duedate = null, $archived = null) {
$done = array_key_exists('done', $this->request->getParams()) ? new OptionalNullableValue($this->request->getParam('done', null)) : null;
$card = $this->cardService->update($this->request->getParam('cardId'), $title, $this->request->getParam('stackId'), $type, $owner, $description, $order, $duedate, 0, $archived, $done);
return new DataResponse($card, HTTP::STATUS_OK);
}