diff --git a/src/db/models/User.helper.ts b/src/db/models/User.helper.ts index 7e6bb8c..9a1df10 100644 --- a/src/db/models/User.helper.ts +++ b/src/db/models/User.helper.ts @@ -39,6 +39,7 @@ export async function getUserCovidPositivity( ): Promise { const user = await getUserByTelegramID(telegramID); if (!user) throw new Error("User not found"); + if (!user.infectionDate) return false; const infectionDuration = new Date().getTime() - user.infectionDate.getTime(); if (infectionDuration > 60 * 60 * 24 * 14 * 1000) { await setUserCovidPositivity(telegramID, false); diff --git a/src/routes/CovidRoute.ts b/src/routes/CovidRoute.ts index d2c9584..9299fca 100644 --- a/src/routes/CovidRoute.ts +++ b/src/routes/CovidRoute.ts @@ -27,7 +27,7 @@ export async function CovidRoute(req: CovidRouteRequest, res: Response) { } } catch (error) { res - .send(500) + .status(500) .send({ error: error instanceof Error ? error.message : "Error" }); } }