aboutsummaryrefslogtreecommitdiff
path: root/web/ui/src/routes/dashboard/usage/+page.server.ts
blob: 34ff0028a5d2af2a908933c4ac13fe8118c1d998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { PLANS } from '$lib/plans';
import { usageByDataset, usageByKey, usageCountThisMonth } from '$lib/server/usage';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async ({ locals }) => {
  const account = locals.account!;
  return {
    plan: PLANS[account.plan],
    total: usageCountThisMonth(account.id),
    byDataset: usageByDataset(account.id),
    byKey: usageByKey(account.id)
  };
};