aboutsummaryrefslogtreecommitdiff
path: root/web/ui/src/routes/dashboard/usage/+page.server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/ui/src/routes/dashboard/usage/+page.server.ts')
-rw-r--r--web/ui/src/routes/dashboard/usage/+page.server.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/web/ui/src/routes/dashboard/usage/+page.server.ts b/web/ui/src/routes/dashboard/usage/+page.server.ts
new file mode 100644
index 0000000..34ff002
--- /dev/null
+++ b/web/ui/src/routes/dashboard/usage/+page.server.ts
@@ -0,0 +1,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)
+ };
+};