Add admin portal

This commit is contained in:
Jose Selesan
2026-06-10 09:39:20 -03:00
parent c278c78e3d
commit c1c2f18471
50 changed files with 2713 additions and 69 deletions

View File

@@ -0,0 +1,24 @@
import { db } from '@/lib/prisma';
import type { AppContext } from '@/types/hono';
export async function listPlansAdminHandler(c: AppContext) {
const plans = await db.plan.findMany({
orderBy: { price: 'asc' },
include: {
_count: {
select: { complexes: true },
},
},
});
return c.json(
plans.map((plan) => ({
code: plan.code,
name: plan.name,
price: Number(plan.price),
rules: plan.rules,
lastUpdatedAt: plan.lastUpdatedAt.toISOString(),
complexCount: plan._count.complexes,
}))
);
}