feat: add plan stacking

This commit is contained in:
2026-03-24 21:47:25 +04:00
parent 7b8f693710
commit b987024f9d
9 changed files with 381 additions and 19 deletions
+2 -1
View File
@@ -115,7 +115,7 @@ export const account = new Elysia({ prefix: "/account" })
.use(requireAuth)
.get("/settings", async ({ accountId }) => {
const [acc] = await sql`SELECT id, email_hash, plan, plan_expires_at, created_at FROM accounts WHERE id = ${accountId}`;
const [acc] = await sql`SELECT id, email_hash, plan, plan_expires_at, plan_stack, created_at FROM accounts WHERE id = ${accountId}`;
const keys = await sql`SELECT id, key, label, created_at, last_used_at FROM api_keys WHERE account_id = ${accountId} ORDER BY created_at DESC`;
const [{ count: monitorCount }] = await sql`SELECT COUNT(*)::int as count FROM monitors WHERE account_id = ${accountId}`;
const limits = getPlanLimits(acc.plan);
@@ -124,6 +124,7 @@ export const account = new Elysia({ prefix: "/account" })
has_email: !!acc.email_hash,
plan: acc.plan,
plan_expires_at: acc.plan_expires_at,
plan_stack: acc.plan_stack || [],
monitor_count: monitorCount,
limits,
created_at: acc.created_at,