From 9400f1234bdda783c04681e9e298321028d6ab00 Mon Sep 17 00:00:00 2001 From: Dany Date: Sun, 16 Jul 2023 10:38:20 +0200 Subject: [PATCH] sync with core --- .changeset/red-shrimps-visit.md | 5 +++ .eslintrc.cjs | 3 +- api/models/Setting.ts | 4 +-- api/services/SettingsGeneralService.ts | 10 ++---- catapi.json | 43 +++----------------------- 5 files changed, 15 insertions(+), 50 deletions(-) create mode 100644 .changeset/red-shrimps-visit.md diff --git a/.changeset/red-shrimps-visit.md b/.changeset/red-shrimps-visit.md new file mode 100644 index 0000000..47f0b97 --- /dev/null +++ b/.changeset/red-shrimps-visit.md @@ -0,0 +1,5 @@ +--- +"ccat-api": patch +--- + +Sync with Cheshire Cat Core diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 3913528..b5eb59b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -15,7 +15,8 @@ module.exports = { rules: { "no-throw-literal": "off", "@typescript-eslint/no-throw-literal": "error", - "@typescript-eslint/no-explicit-any": "warn" + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/ban-tslint-comment": "off" }, root: true, }; \ No newline at end of file diff --git a/api/models/Setting.ts b/api/models/Setting.ts index a87c50a..76758bd 100644 --- a/api/models/Setting.ts +++ b/api/models/Setting.ts @@ -8,7 +8,5 @@ export type Setting = { name: string; value: Record; category?: string; - enabled?: boolean; - createdAt?: string; - updatedAt?: string; + updated_at?: number; }; diff --git a/api/services/SettingsGeneralService.ts b/api/services/SettingsGeneralService.ts index bc0b9c6..7c5fd8b 100644 --- a/api/services/SettingsGeneralService.ts +++ b/api/services/SettingsGeneralService.ts @@ -16,23 +16,17 @@ export class SettingsGeneralService { /** * Get Settings * Get the entire list of settings available in the database - * @param limit The maximum number of settings to fetch - * @param page The number of settings' page to fetch * @param search The setting to search * @returns SettingsList Successful Response * @throws ApiError */ public getSettings( -limit: number = 100, -page: number = 1, search: string = '', ): CancelablePromise { return this.httpRequest.request({ method: 'GET', url: '/settings/', query: { - 'limit': limit, - 'page': page, 'search': search, }, errors: { @@ -108,7 +102,7 @@ settingId: string, /** * Update Setting - * Update a specific setting in the database + * Update a specific setting in the database if it exists * @param settingId * @param requestBody * @returns SettingResponse Successful Response @@ -119,7 +113,7 @@ settingId: string, requestBody: Setting, ): CancelablePromise { return this.httpRequest.request({ - method: 'PATCH', + method: 'PUT', url: '/settings/{settingId}', path: { 'settingId': settingId, diff --git a/catapi.json b/catapi.json index 6b8b00a..2ea13da 100644 --- a/catapi.json +++ b/catapi.json @@ -41,28 +41,6 @@ "description": "Get the entire list of settings available in the database", "operationId": "get_settings", "parameters": [ - { - "required": false, - "schema": { - "title": "Limit", - "type": "integer", - "default": 100 - }, - "description": "The maximum number of settings to fetch", - "name": "limit", - "in": "query" - }, - { - "required": false, - "schema": { - "title": "Page", - "type": "integer", - "default": 1 - }, - "description": "The number of settings' page to fetch", - "name": "page", - "in": "query" - }, { "required": false, "schema": { @@ -224,12 +202,12 @@ }, "security": [] }, - "patch": { + "put": { "tags": [ "Settings - General" ], "summary": "Update Setting", - "description": "Update a specific setting in the database", + "description": "Update a specific setting in the database if it exists", "operationId": "update_setting", "parameters": [ { @@ -1470,20 +1448,9 @@ "type": "string", "default": "general" }, - "enabled": { - "title": "Enabled", - "type": "boolean", - "default": true - }, - "createdAt": { - "title": "Createdat", - "type": "string", - "format": "date-time" - }, - "updatedAt": { - "title": "Updatedat", - "type": "string", - "format": "date-time" + "updated_at": { + "title": "Updated Timestamp", + "type": "number" } } },