diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-04-16 19:04:25 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-04-16 23:50:17 +0000 |
| commit | ba89a864bb4548623ca1bfcfc9ab6eb7fe782603 (patch) | |
| tree | e3b8ddf9d418255f95c18bee76350d441fdd3081 /apps/web/app/api | |
| parent | 5e0f4de1625957c6ce057ae272aa301fc459d31b (diff) | |
| download | karakeep-ba89a864bb4548623ca1bfcfc9ab6eb7fe782603.tar.zst | |
fix: Add includeContent to search endpoint and document it in the docs
Diffstat (limited to 'apps/web/app/api')
| -rw-r--r-- | apps/web/app/api/v1/bookmarks/search/route.ts | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/apps/web/app/api/v1/bookmarks/search/route.ts b/apps/web/app/api/v1/bookmarks/search/route.ts index f0c5417a..52081c7f 100644 --- a/apps/web/app/api/v1/bookmarks/search/route.ts +++ b/apps/web/app/api/v1/bookmarks/search/route.ts @@ -2,29 +2,33 @@ import { NextRequest } from "next/server"; import { z } from "zod"; import { buildHandler } from "../../utils/handler"; +import { zGetBookmarkSearchParamsSchema } from "../../utils/types"; export const dynamic = "force-dynamic"; export const GET = (req: NextRequest) => buildHandler({ req, - searchParamsSchema: z.object({ - q: z.string(), - limit: z.coerce.number().optional(), - cursor: z - .string() - // Search cursor V1 is just a number - .pipe(z.coerce.number()) - .transform((val) => { - return { ver: 1 as const, offset: val }; - }) - .optional(), - }), + searchParamsSchema: z + .object({ + q: z.string(), + limit: z.coerce.number().optional(), + cursor: z + .string() + // Search cursor V1 is just a number + .pipe(z.coerce.number()) + .transform((val) => { + return { ver: 1 as const, offset: val }; + }) + .optional(), + }) + .and(zGetBookmarkSearchParamsSchema), handler: async ({ api, searchParams }) => { const bookmarks = await api.bookmarks.searchBookmarks({ text: searchParams.q, cursor: searchParams.cursor, limit: searchParams.limit, + includeContent: searchParams.includeContent, }); return { status: 200, |
