From 08e348c5c98a314830330c3da0437f691a926dd6 Mon Sep 17 00:00:00 2001 From: aster <137767097+aster-void@users.noreply.github.com> Date: Thu, 20 Feb 2025 15:26:26 +0900 Subject: [PATCH] fix: get by id --- server/src/router/users.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/router/users.ts b/server/src/router/users.ts index 51607cc4..771c9fca 100644 --- a/server/src/router/users.ts +++ b/server/src/router/users.ts @@ -3,6 +3,7 @@ import { GUIDSchema, InitUserSchema, UpdateUserSchema, + UserIDSchema, } from "common/zod/schemas"; import { Hono } from "hono"; import { z } from "zod"; @@ -88,8 +89,8 @@ const router = new Hono() }) // idでユーザーを取得 - .get("/id/:id", async (c) => { - const userId = await getUserId(c); + .get("/id/:id", param({ id: UserIDSchema }), async (c) => { + const userId = c.req.valid("param").id; const user = await getUserByID(userId); c.status(200); return c.json(user);