Skip to content

Commit

Permalink
feat: increase playground allowance for pro plan
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed Mar 5, 2024
1 parent b088ae3 commit 9ee1034
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/backend/src/jobs/resetUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,19 @@ 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';`
}

export default async function resetUsage() {
try {
console.log("[JOB]: resetting AI allowance")
await resetAIallowance()
await resetPlaygroundAllowance()
} catch (error) {
console.error(error)
}
Expand Down

0 comments on commit 9ee1034

Please sign in to comment.