mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Monitoring Settings
This commit is contained in:
@@ -3,8 +3,8 @@ import prisma from "@/app/prisma";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
const schema = z.object({
|
||||
frequency: z.number(),
|
||||
checksUntilOffline: z.number(),
|
||||
frequency: z.number().min(1, { message: "Frequency must be greater than 0" }).max(1000, { message: "Frequency must be less than 1000" }),
|
||||
checksUntilOffline: z.number().min(1, { message: "Checks until offline must be greater than 0" }).max(1000, { message: "Checks until offline must be less than 1000" }),
|
||||
})
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
18
app/api/monitoring/applications/get_general/route.ts
Normal file
18
app/api/monitoring/applications/get_general/route.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const generalSettings = await prisma.generalApplicationMonitoringSettings.findFirst({
|
||||
where: {
|
||||
applicationSettings: {
|
||||
none: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
return NextResponse.json(generalSettings, { status: 200 });
|
||||
} catch (error) {
|
||||
return NextResponse.json({ error: "Failed to get general settings" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import prisma from "@/app/prisma";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
const schema = z.object({
|
||||
frequency: z.number(),
|
||||
checksUntilOffline: z.number(),
|
||||
frequency: z.number().min(1, { message: "Frequency must be greater than 0" }).max(1000, { message: "Frequency must be less than 1000" }),
|
||||
checksUntilOffline: z.number().min(1, { message: "Checks until offline must be greater than 0" }).max(1000, { message: "Checks until offline must be less than 1000" }),
|
||||
})
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
|
||||
18
app/api/monitoring/servers/get_general/route.ts
Normal file
18
app/api/monitoring/servers/get_general/route.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import prisma from "@/app/prisma";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const generalSettings = await prisma.generalServerMonitoringSettings.findFirst({
|
||||
where: {
|
||||
serverSettings: {
|
||||
none: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return NextResponse.json(generalSettings, { status: 200 });
|
||||
} catch (error) {
|
||||
return NextResponse.json({ error: "Failed to get general settings" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user