From 33f10a7f91e3c06201291d9e9173bfe7d76e4e29 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 30 May 2024 14:42:32 -0700 Subject: [PATCH] Nick: fixes --- apps/api/src/controllers/auth.ts | 7 ++++--- apps/api/src/services/rate-limiter.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts index 33e9695..2154504 100644 --- a/apps/api/src/controllers/auth.ts +++ b/apps/api/src/controllers/auth.ts @@ -104,12 +104,13 @@ export async function supaAuthenticateUser( case RateLimiterMode.Scrape: rateLimiter = getRateLimiter(RateLimiterMode.Scrape, token, subscriptionData.plan); break; + case RateLimiterMode.Search: + rateLimiter = getRateLimiter(RateLimiterMode.Search, token, subscriptionData.plan); + break; case RateLimiterMode.CrawlStatus: rateLimiter = getRateLimiter(RateLimiterMode.CrawlStatus, token); break; - case RateLimiterMode.Search: - rateLimiter = getRateLimiter(RateLimiterMode.Search, token); - break; + case RateLimiterMode.Preview: rateLimiter = getRateLimiter(RateLimiterMode.Preview, token); break; diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index 6e09310..a0a6f16 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -62,7 +62,7 @@ export function getRateLimiter(mode: RateLimiterMode, token: string, plan?: stri if (!rateLimitConfig) return serverRateLimiter; const planKey = plan ? plan.replace("-", "") : "starter"; - const points = rateLimitConfig[planKey] || rateLimitConfig.free; + const points = rateLimitConfig[planKey] || rateLimitConfig.preview; return createRateLimiter(`${mode}-${planKey}`, points); }