Add m_cpu, m_gpu, m_ram, m_disk, and m_temp boolean fields to AddRequest and EditRequest interfaces

This commit is contained in:
headlessdev 2025-05-01 19:29:33 +02:00
parent a2b9d92dd4
commit 1d02f5f237
2 changed files with 24 additions and 5 deletions

View File

@ -15,13 +15,17 @@ interface AddRequest {
disk: string;
monitoring: boolean;
monitoringURL: string;
m_cpu: boolean;
m_gpu: boolean;
m_ram: boolean;
m_disk: boolean;
m_temp: boolean;
}
export async function POST(request: NextRequest) {
try {
const body: AddRequest = await request.json();
const { host, hostServer, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL } = body;
const { host, hostServer, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL, m_cpu, m_gpu, m_ram, m_disk, m_temp } = body;
const server = await prisma.server.create({
data: {
@ -37,7 +41,12 @@ export async function POST(request: NextRequest) {
ram,
disk,
monitoring,
monitoringURL
monitoringURL,
m_cpu,
m_gpu,
m_ram,
m_disk,
m_temp
}
});

View File

@ -16,12 +16,17 @@ interface EditRequest {
disk: string;
monitoring: boolean;
monitoringURL: string;
m_cpu: boolean;
m_gpu: boolean;
m_ram: boolean;
m_disk: boolean;
m_temp: boolean;
}
export async function PUT(request: NextRequest) {
try {
const body: EditRequest = await request.json();
const { host, hostServer, id, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL } = body;
const { host, hostServer, id, name, icon, os, ip, url, cpu, gpu, ram, disk, monitoring, monitoringURL, m_cpu, m_gpu, m_ram, m_disk, m_temp } = body;
const existingServer = await prisma.server.findUnique({ where: { id } });
if (!existingServer) {
@ -50,7 +55,12 @@ export async function PUT(request: NextRequest) {
ram,
disk,
monitoring,
monitoringURL
monitoringURL,
m_cpu,
m_gpu,
m_ram,
m_disk,
m_temp
}
});