From 20e5225e0547978cab656e94a3519cd590a16d8a Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 20 Oct 2024 15:40:51 +0000 Subject: feature(api): Add REST APIs to manipulate lists and tags for bookmarks --- packages/shared/types/bookmarks.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'packages/shared') diff --git a/packages/shared/types/bookmarks.ts b/packages/shared/types/bookmarks.ts index a9708f73..c8ab96f9 100644 --- a/packages/shared/types/bookmarks.ts +++ b/packages/shared/types/bookmarks.ts @@ -157,3 +157,15 @@ export const zUpdateBookmarksRequestSchema = z.object({ export type ZUpdateBookmarksRequest = z.infer< typeof zUpdateBookmarksRequestSchema >; + +// The schema that's used to for attachig/detaching tags +export const zManipulatedTagSchema = z + .object({ + // At least one of the two must be set + tagId: z.string().optional(), // If the tag already exists and we know its id we should pass it + tagName: z.string().optional(), + }) + .refine((val) => !!val.tagId || !!val.tagName, { + message: "You must provide either a tagId or a tagName", + path: ["tagId", "tagName"], + }); -- cgit v1.2.3-70-g09d2