From bcdd7b6da7b6a579104a61eb736e66d2ea5feb3a Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Sun, 1 Dec 2024 00:42:54 -0800 Subject: [PATCH] Fix lint error --- .../api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts b/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts index 61024a005..7bc3cfb3f 100644 --- a/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts +++ b/apps/backend/src/app/api/v1/integrations/neon/oauth/idp/[[...route]]/idp.ts @@ -48,7 +48,11 @@ function createAdapter(options: { } async upsert(id: string, payload: AdapterPayload, expiresInSeconds: number): Promise { - await niceUpdate(this.model, id, () => ({ payload, expiresAt: new Date(Date.now() + (+expiresInSeconds ?? 0) * 1000) })); + if (expiresInSeconds < 0) expiresInSeconds = 0; + if (expiresInSeconds > 60 * 60 * 24 * 365 * 100) expiresInSeconds = 60 * 60 * 24 * 365 * 100; + if (!Number.isFinite(expiresInSeconds)) expiresInSeconds = 0; + + await niceUpdate(this.model, id, () => ({ payload, expiresAt: new Date(Date.now() + expiresInSeconds * 1000) })); } async find(id: string): Promise {