Dashboard

This commit is contained in:
headlessdev
2025-04-12 19:34:20 +02:00
parent fd3e81b5c1
commit cd8a801fff
2 changed files with 96 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
import { NextResponse, NextRequest } from "next/server";
import { PrismaClient } from '@/lib/generated/prisma';
const prisma = new PrismaClient();
export async function POST(request: NextRequest) {
try {
const serverCount = await prisma.server.count();
const applicationCount = await prisma.application.count();
const onlineApplicationsCount = await prisma.application.count({
where: { online: true }
});
return NextResponse.json({
serverCount,
applicationCount,
onlineApplicationsCount
});
} catch (error: any) {
return NextResponse.json({ error: error.message }, { status: 500 });
}
}