From 9ee10341c7dbba1cf2ea5d06e9a8eadd8b051360 Mon Sep 17 00:00:00 2001 From: hughcrt Date: Mon, 4 Mar 2024 22:00:19 -0300 Subject: [PATCH] feat: increase playground allowance for pro plan --- packages/backend/src/jobs/resetUsage.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/jobs/resetUsage.ts b/packages/backend/src/jobs/resetUsage.ts index e4443d2a..5a074530 100644 --- a/packages/backend/src/jobs/resetUsage.ts +++ b/packages/backend/src/jobs/resetUsage.ts @@ -57,15 +57,11 @@ RETURNING *;` } } -// reset org.ai_allowance: -// - 3 for free users -// - 10 for 'pro' users -// - 1000 for 'unlimited' and 'enterprise' users - -async function resetAIallowance() { +// reset playground allowance +async function resetPlaygroundAllowance() { await sql`UPDATE "public"."org" o SET play_allowance = 3 WHERE o.plan = 'free';` - await sql`UPDATE "public"."org" o SET play_allowance = 15 WHERE o.plan = 'pro';` + await sql`UPDATE "public"."org" o SET play_allowance = 1000 WHERE o.plan = 'pro';` await sql`UPDATE "public"."org" o SET play_allowance = 1000 WHERE o.plan = 'unlimited' OR o.plan = 'custom';` } @@ -73,7 +69,7 @@ async function resetAIallowance() { export default async function resetUsage() { try { console.log("[JOB]: resetting AI allowance") - await resetAIallowance() + await resetPlaygroundAllowance() } catch (error) { console.error(error) }