Replace account and license-keys pages with profile page and dashboard

This commit is contained in:
NeilClack
2026-09-10 13:11:41 -05:00
parent f50eb34769
commit 1aecc51bbd
20 changed files with 157 additions and 254 deletions
@@ -7,23 +7,10 @@ export const load: PageServerLoad = async ({ locals }) => {
throw error(403, 'not authorized');
}
const profile = await prisma.profile.findFirst({
const licenseKeys = await prisma.licenseKey.findMany({
where: { userId: locals.user.id },
select: { firstName: true }
orderBy: { createdAt: 'desc' }
});
const keyStats = await prisma.licenseKey.groupBy({
by: ['active'],
where: { userId: locals.user.id },
_count: true
});
const activeKeys = keyStats.find((s) => s.active)?._count ?? 0;
const totalKeys = keyStats.reduce((sum, s) => sum + s._count, 0);
return {
firstName: profile?.firstName ?? 'User',
activeKeys,
totalKeys
};
return { licenseKeys };
};