Skip to content

Commit 7f7524d

Browse files
hotfix: restaurant today no data (#319)
1. When there's no data, don't 500 with a Zod parse error. 2. The error message should indicate that there is no data, not that the restaurant ID is bad, because the restaurant ID enum schema already checks that the ID is valid.
1 parent d4f21c2 commit 7f7524d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/api/src/rest/routes/dining.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ diningRouter.openapi(restaurantTodayRoute, async (c) => {
250250
const query = c.req.valid("query");
251251
const service = new DiningService(database(c.env.DB.connectionString));
252252

253-
const data = restaurantTodayResponseSchema.parse(await service.getRestaurantToday(query));
253+
const data = await service.getRestaurantToday(query);
254254
if (!data) {
255-
return c.json({ ok: false, message: "Restaurant not found" }, 404);
255+
return c.json({ ok: false, message: "No data for this day" }, 404);
256256
}
257-
return c.json({ ok: true, data: data }, 200);
257+
return c.json({ ok: true, data: restaurantTodayResponseSchema.parse(data) }, 200);
258258
});
259259

260260
export { diningRouter };

0 commit comments

Comments
 (0)