|
|
@@ -253,7 +253,7 @@ export function createCrudRoutes<
|
|
|
);
|
|
|
|
|
|
return c.json({
|
|
|
- data,
|
|
|
+ data: z.array(listSchema).parse(data),
|
|
|
pagination: { total, current: page, pageSize }
|
|
|
}, 200);
|
|
|
} catch (error) {
|
|
|
@@ -291,7 +291,7 @@ export function createCrudRoutes<
|
|
|
return c.json({ code: 404, message: '资源不存在' }, 404);
|
|
|
}
|
|
|
|
|
|
- return c.json(result, 200);
|
|
|
+ return c.json(getSchema.parse(result), 200);
|
|
|
} catch (error) {
|
|
|
if (error instanceof z.ZodError) {
|
|
|
return c.json({ code: 400, message: '参数验证失败', errors: error.errors }, 400);
|