|
|
@@ -10,9 +10,9 @@ import { UserSchema } from '@/server/modules/users/user.entity';
|
|
|
const userService = new UserService(AppDataSource);
|
|
|
|
|
|
const GetParams = z.object({
|
|
|
- id: z.string().openapi({
|
|
|
+ id: z.coerce.number().openapi({
|
|
|
param: { name: 'id', in: 'path' },
|
|
|
- example: '1',
|
|
|
+ example: 1,
|
|
|
description: '用户ID'
|
|
|
})
|
|
|
});
|
|
|
@@ -43,7 +43,7 @@ const routeDef = createRoute({
|
|
|
const app = new OpenAPIHono<AuthContext>().openapi(routeDef, async (c) => {
|
|
|
try {
|
|
|
const { id } = c.req.valid('param');
|
|
|
- const user = await userService.getUserById(parseInt(id));
|
|
|
+ const user = await userService.getUserById(id);
|
|
|
if (!user) {
|
|
|
return c.json({ code: 404, message: '用户不存在' }, 404);
|
|
|
}
|