From 5ecdc36b7d60aa66b49e01e9fec8ba61ad537376 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Thu, 2 Jan 2025 13:00:58 +0200 Subject: feat: Add support for smart lists (#802) * feat: Add support for smart lists * i18n * Fix update list endpoint * Add a test for smart lists * Add header to the query explainer * Hide remove from lists in the smart context list * Add proper validation to list form --------- Co-authored-by: Deepak Kapoor <41769111+orthdron@users.noreply.github.com> --- packages/open-api/hoarder-openapi-spec.json | 28 ++++++++++++++++++++++++++++ packages/open-api/lib/lists.ts | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'packages/open-api') diff --git a/packages/open-api/hoarder-openapi-spec.json b/packages/open-api/hoarder-openapi-spec.json index 46e5ea0f..fecea0c2 100644 --- a/packages/open-api/hoarder-openapi-spec.json +++ b/packages/open-api/hoarder-openapi-spec.json @@ -362,6 +362,18 @@ "parentId": { "type": "string", "nullable": true + }, + "type": { + "type": "string", + "enum": [ + "manual", + "smart" + ], + "default": "manual" + }, + "query": { + "type": "string", + "nullable": true } }, "required": [ @@ -1058,6 +1070,18 @@ "icon": { "type": "string" }, + "type": { + "type": "string", + "enum": [ + "manual", + "smart" + ], + "default": "manual" + }, + "query": { + "type": "string", + "minLength": 1 + }, "parentId": { "type": "string", "nullable": true @@ -1171,6 +1195,10 @@ "parentId": { "type": "string", "nullable": true + }, + "query": { + "type": "string", + "minLength": 1 } } } diff --git a/packages/open-api/lib/lists.ts b/packages/open-api/lib/lists.ts index 07c9fde9..4b728a1e 100644 --- a/packages/open-api/lib/lists.ts +++ b/packages/open-api/lib/lists.ts @@ -6,6 +6,7 @@ import { z } from "zod"; import { zBookmarkListSchema, + zEditBookmarkListSchema, zNewBookmarkListSchema, } from "@hoarder/shared/types/lists"; @@ -132,7 +133,7 @@ registry.registerPath({ "The data to update. Only the fields you want to update need to be provided.", content: { "application/json": { - schema: zNewBookmarkListSchema.partial(), + schema: zEditBookmarkListSchema.omit({ listId: true }), }, }, }, -- cgit v1.2.3-70-g09d2