mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 23:47:13 +00:00
Refactor server count retrieval in POST request to differentiate between servers with and without VMs
This commit is contained in:
parent
f1c0cc9deb
commit
965f79f31a
@ -3,7 +3,19 @@ import { prisma } from "@/lib/prisma";
|
|||||||
|
|
||||||
export async function POST(request: NextRequest) {
|
export async function POST(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const serverCount = await prisma.server.count();
|
const serverCountNoVMs = await prisma.server.count({
|
||||||
|
where: {
|
||||||
|
hostServer: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const serverCountOnlyVMs = await prisma.server.count({
|
||||||
|
where: {
|
||||||
|
hostServer: {
|
||||||
|
not: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const applicationCount = await prisma.application.count();
|
const applicationCount = await prisma.application.count();
|
||||||
|
|
||||||
@ -12,7 +24,8 @@ export async function POST(request: NextRequest) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
serverCount,
|
serverCountNoVMs,
|
||||||
|
serverCountOnlyVMs,
|
||||||
applicationCount,
|
applicationCount,
|
||||||
onlineApplicationsCount
|
onlineApplicationsCount
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user