mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 16:07:10 +00:00
25 lines
708 B
TypeScript
25 lines
708 B
TypeScript
|
|
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 });
|
||
|
|
}
|
||
|
|
}
|