diff options
Diffstat (limited to 'packages/shared')
| -rw-r--r-- | packages/shared/types/bookmarks.ts | 12 |
1 files changed, 12 insertions, 0 deletions
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"], + }); |
