Monitoring Settings

This commit is contained in:
headlessdev
2025-05-31 12:36:58 +02:00
parent 307062b5be
commit 6c1fca1377
12 changed files with 303 additions and 22 deletions

View File

@@ -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) {

View 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 });
}
}

View File

@@ -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) {

View 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 });
}
}