diff options
Diffstat (limited to 'apps/web/app/api/v1/lists')
| -rw-r--r-- | apps/web/app/api/v1/lists/[listId]/route.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/web/app/api/v1/lists/[listId]/route.ts b/apps/web/app/api/v1/lists/[listId]/route.ts index f5af286d..69c99fda 100644 --- a/apps/web/app/api/v1/lists/[listId]/route.ts +++ b/apps/web/app/api/v1/lists/[listId]/route.ts @@ -1,6 +1,8 @@ import { NextRequest } from "next/server"; import { buildHandler } from "@/app/api/v1/utils/handler"; +import { zNewBookmarkListSchema } from "@hoarder/shared/types/lists"; + export const dynamic = "force-dynamic"; export const GET = ( @@ -20,6 +22,22 @@ export const GET = ( }, }); +export const PATCH = ( + req: NextRequest, + { params }: { params: { listId: string } }, +) => + buildHandler({ + req, + bodySchema: zNewBookmarkListSchema.partial(), + handler: async ({ api, body }) => { + const list = await api.lists.edit({ + listId: params.listId, + ...body!, + }); + return { status: 200, resp: list }; + }, + }); + export const DELETE = ( req: NextRequest, { params }: { params: { listId: string } }, |
