feat: create new card from smart picker

Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
Luka Trovic
2023-08-04 07:25:45 +02:00
committed by Julius Härtl
parent ba56687982
commit 12217afe65
16 changed files with 927 additions and 469 deletions

View File

@@ -82,8 +82,17 @@ class CardApiController extends ApiController {
*
* Get a specific card.
*/
public function create($title, $type = 'plain', $order = 999, $description = '', $duedate = null) {
public function create($title, $type = 'plain', $order = 999, $description = '', $duedate = null, $labels = [], $users = []) {
$card = $this->cardService->create($title, $this->request->getParam('stackId'), $type, $order, $this->userId, $description, $duedate);
foreach ($labels as $labelId) {
$this->cardService->assignLabel($card->id, $labelId);
}
foreach ($users as $user) {
$this->assignmentService->assignUser($card->id, $user['id'], $user['type']);
}
return new DataResponse($card, HTTP::STATUS_OK);
}

View File

@@ -77,8 +77,18 @@ class CardController extends Controller {
* @param int $order
* @return \OCP\AppFramework\Db\Entity
*/
public function create($title, $stackId, $type = 'plain', $order = 999, string $description = '') {
return $this->cardService->create($title, $stackId, $type, $order, $this->userId, $description);
public function create($title, $stackId, $type = 'plain', $order = 999, string $description = '', $duedate = null, $labels = [], $users = []) {
$card = $this->cardService->create($title, $stackId, $type, $order, $this->userId, $description, $duedate);
foreach ($labels as $label) {
$this->assignLabel($card->id, $label);
}
foreach ($users as $user) {
$this->assignmentService->assignUser($card->id, $user['id'], $user['type']);
}
return $card;
}
/**