diff options
Diffstat (limited to 'apps/web/app/api/v1/bookmarks')
| -rw-r--r-- | apps/web/app/api/v1/bookmarks/[bookmarkId]/route.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/app/api/v1/bookmarks/[bookmarkId]/route.ts b/apps/web/app/api/v1/bookmarks/[bookmarkId]/route.ts index 0315ff8c..8fe4d9fe 100644 --- a/apps/web/app/api/v1/bookmarks/[bookmarkId]/route.ts +++ b/apps/web/app/api/v1/bookmarks/[bookmarkId]/route.ts @@ -1,6 +1,8 @@ import { NextRequest } from "next/server"; import { buildHandler } from "@/app/api/v1/utils/handler"; +import { zUpdateBookmarksRequestSchema } from "@hoarder/shared/types/bookmarks"; + export const dynamic = "force-dynamic"; export const GET = ( @@ -17,6 +19,22 @@ export const GET = ( }, }); +export const PATCH = ( + req: NextRequest, + { params }: { params: { bookmarkId: string } }, +) => + buildHandler({ + req, + bodySchema: zUpdateBookmarksRequestSchema.omit({ bookmarkId: true }), + handler: async ({ api, body }) => { + const bookmark = await api.bookmarks.updateBookmark({ + bookmarkId: params.bookmarkId, + ...body!, + }); + return { status: 200, resp: bookmark }; + }, + }); + export const DELETE = ( req: NextRequest, { params }: { params: { bookmarkId: string } }, |
