From ac14dfa3f6bbaecae0ad74797be95c926f27cf31 Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Tue, 9 Apr 2024 16:29:06 +0200 Subject: [PATCH] add tables Description to createTable Signed-off-by: grnd-alt --- lib/Controller/ApiTablesController.php | 5 +++-- lib/Service/TableService.php | 3 ++- openapi.json | 9 +++++++++ src/modules/modals/CreateTable.vue | 17 +++++++++++++++++ src/store/store.js | 2 +- src/types/openapi/openapi.ts | 2 ++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/lib/Controller/ApiTablesController.php b/lib/Controller/ApiTablesController.php index 11cf56962..0ee061d20 100644 --- a/lib/Controller/ApiTablesController.php +++ b/lib/Controller/ApiTablesController.php @@ -78,15 +78,16 @@ public function show(int $id): DataResponse { * * @param string $title Title of the table * @param string|null $emoji Emoji for the table + * @param string|null $description Description for the table * @param string $template Template to use if wanted * * @return DataResponse|DataResponse * * 200: Tables returned */ - public function create(string $title, ?string $emoji, string $template = 'custom'): DataResponse { + public function create(string $title, ?string $emoji, ?string $description, string $template = 'custom'): DataResponse { try { - return new DataResponse($this->service->create($title, $template, $emoji)->jsonSerialize()); + return new DataResponse($this->service->create($title, $template, $emoji, $description)->jsonSerialize()); } catch (InternalError|Exception $e) { return $this->handleError($e); } diff --git a/lib/Service/TableService.php b/lib/Service/TableService.php index 7f6dec1f8..2ee7685d7 100644 --- a/lib/Service/TableService.php +++ b/lib/Service/TableService.php @@ -255,12 +255,13 @@ public function find(int $id, bool $skipTableEnhancement = false, ?string $userI * @throws InternalError * @noinspection DuplicatedCode */ - public function create(string $title, string $template, ?string $emoji, ?string $userId = null): Table { + public function create(string $title, string $template, ?string $emoji, ?string $description = '', ?string $userId = null): Table { $userId = $this->permissionsService->preCheckUserId($userId, false); // we can assume that the $userId is set $time = new DateTime(); $item = new Table(); $item->setTitle($title); + $item->setDescription($description); if($emoji) { $item->setEmoji($emoji); } diff --git a/openapi.json b/openapi.json index 18788f5ec..41d136387 100644 --- a/openapi.json +++ b/openapi.json @@ -5077,6 +5077,15 @@ "nullable": true } }, + { + "name": "description", + "in": "query", + "description": "Description for the table", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "template", "in": "query", diff --git a/src/modules/modals/CreateTable.vue b/src/modules/modals/CreateTable.vue index 3eceaf1d9..1dcd7801c 100644 --- a/src/modules/modals/CreateTable.vue +++ b/src/modules/modals/CreateTable.vue @@ -28,6 +28,14 @@ @input="titleChangedManually"> +
+
+ {{ t('tables', 'Description') }} +
+
+ +
+