Browse Source

Merge pull request #13 from naresh97/development

bugfix: issue when getting covid positivity of new user
main
Nareshkumar Rao 3 years ago
committed by GitHub
parent
commit
a9d0039d98
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/db/models/User.helper.ts
  2. 2
      src/routes/CovidRoute.ts

1
src/db/models/User.helper.ts

@ -39,6 +39,7 @@ export async function getUserCovidPositivity(
): Promise<boolean> {
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);

2
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" });
}
}

Loading…
Cancel
Save