From 3f56389f55ef116f8cea17c15c684798fb942290 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Fri, 27 Dec 2024 19:21:43 +0000 Subject: feat: Add REST APIs for manipulating highlights. Fixes #620 --- packages/shared/types/bookmarks.ts | 6 +----- packages/shared/types/highlights.ts | 2 ++ packages/shared/types/pagination.ts | 6 ++++++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 packages/shared/types/pagination.ts (limited to 'packages/shared') diff --git a/packages/shared/types/bookmarks.ts b/packages/shared/types/bookmarks.ts index 359ff7c4..41f689cd 100644 --- a/packages/shared/types/bookmarks.ts +++ b/packages/shared/types/bookmarks.ts @@ -1,5 +1,6 @@ import { z } from "zod"; +import { zCursorV2 } from "./pagination"; import { zBookmarkTagSchema } from "./tags"; const MAX_TITLE_LENGTH = 250; @@ -147,11 +148,6 @@ export type ZNewBookmarkRequest = z.infer; export const DEFAULT_NUM_BOOKMARKS_PER_PAGE = 20; export const MAX_NUM_BOOKMARKS_PER_PAGE = 100; -export const zCursorV2 = z.object({ - createdAt: z.date(), - id: z.string(), -}); - export const zGetBookmarksRequestSchema = z.object({ ids: z.array(z.string()).optional(), archived: z.boolean().optional(), diff --git a/packages/shared/types/highlights.ts b/packages/shared/types/highlights.ts index b766c360..9bda6029 100644 --- a/packages/shared/types/highlights.ts +++ b/packages/shared/types/highlights.ts @@ -1,5 +1,7 @@ import { z } from "zod"; +export const DEFAULT_NUM_HIGHLIGHTS_PER_PAGE = 20; + const zHighlightColorSchema = z.enum(["yellow", "red", "green", "blue"]); export type ZHighlightColor = z.infer; export const SUPPORTED_HIGHLIGHT_COLORS = zHighlightColorSchema.options; diff --git a/packages/shared/types/pagination.ts b/packages/shared/types/pagination.ts new file mode 100644 index 00000000..d2312982 --- /dev/null +++ b/packages/shared/types/pagination.ts @@ -0,0 +1,6 @@ +import { z } from "zod"; + +export const zCursorV2 = z.object({ + createdAt: z.date(), + id: z.string(), +}); -- cgit v1.2.3-70-g09d2