mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Add monitoring fields to server add and edit routes, including monitoring status and URL in request handling.
This commit is contained in:
parent
d1549bf096
commit
4a647ac19b
@ -13,13 +13,15 @@ interface AddRequest {
|
|||||||
gpu: string;
|
gpu: string;
|
||||||
ram: string;
|
ram: string;
|
||||||
disk: string;
|
disk: string;
|
||||||
|
monitoring: boolean;
|
||||||
|
monitoringURL: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function POST(request: NextRequest) {
|
export async function POST(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const body: AddRequest = await request.json();
|
const body: AddRequest = await request.json();
|
||||||
const { host, hostServer, name, icon, os, ip, url, cpu, gpu, ram, disk } = body;
|
const { host, hostServer, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL } = body;
|
||||||
|
|
||||||
const server = await prisma.server.create({
|
const server = await prisma.server.create({
|
||||||
data: {
|
data: {
|
||||||
@ -33,7 +35,9 @@ export async function POST(request: NextRequest) {
|
|||||||
cpu,
|
cpu,
|
||||||
gpu,
|
gpu,
|
||||||
ram,
|
ram,
|
||||||
disk
|
disk,
|
||||||
|
monitoring,
|
||||||
|
monitoringURL
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -14,12 +14,14 @@ interface EditRequest {
|
|||||||
gpu: string;
|
gpu: string;
|
||||||
ram: string;
|
ram: string;
|
||||||
disk: string;
|
disk: string;
|
||||||
|
monitoring: boolean;
|
||||||
|
monitoringURL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PUT(request: NextRequest) {
|
export async function PUT(request: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const body: EditRequest = await request.json();
|
const body: EditRequest = await request.json();
|
||||||
const { host, hostServer, id, name, icon, os, ip, url, cpu, gpu, ram, disk } = body;
|
const { host, hostServer, id, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL } = body;
|
||||||
|
|
||||||
const existingServer = await prisma.server.findUnique({ where: { id } });
|
const existingServer = await prisma.server.findUnique({ where: { id } });
|
||||||
if (!existingServer) {
|
if (!existingServer) {
|
||||||
@ -46,7 +48,9 @@ export async function PUT(request: NextRequest) {
|
|||||||
cpu,
|
cpu,
|
||||||
gpu,
|
gpu,
|
||||||
ram,
|
ram,
|
||||||
disk
|
disk,
|
||||||
|
monitoring,
|
||||||
|
monitoringURL
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user