diff --git a/apps/api/src/routes/portal.ts b/apps/api/src/routes/portal.ts index f7f5b07..a4c2b87 100644 --- a/apps/api/src/routes/portal.ts +++ b/apps/api/src/routes/portal.ts @@ -102,7 +102,6 @@ portalRouter.get("/appointments", async (c) => { const db = getDb(); const clientId = c.get("portalClientId"); - const now = new Date(); const allAppts = await db .select({ id: appointments.id, diff --git a/apps/api/src/routes/setup.ts b/apps/api/src/routes/setup.ts index a84e61d..495fd66 100644 --- a/apps/api/src/routes/setup.ts +++ b/apps/api/src/routes/setup.ts @@ -9,8 +9,8 @@ const RATE_LIMIT_MAX = 10; const rateLimitMap = new Map(); function rateLimitByIp(ip: string): { allowed: boolean; remaining: number } { - const now = Date.now(); const entry = rateLimitMap.get(ip); + const now = Date.now(); if (!entry || now > entry.resetAt) { rateLimitMap.set(ip, { count: 1, resetAt: now + RATE_LIMIT_WINDOW_MS }); return { allowed: true, remaining: RATE_LIMIT_MAX - 1 };