mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Add host and hostServer fields to AddRequest and EditRequest interfaces
This commit is contained in:
parent
01470f5ce1
commit
c266296c4f
@ -2,6 +2,8 @@ import { NextResponse, NextRequest } from "next/server";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
interface AddRequest {
|
||||
host: boolean;
|
||||
hostServer: number;
|
||||
name: string;
|
||||
os: string;
|
||||
ip: string;
|
||||
@ -16,10 +18,12 @@ interface AddRequest {
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body: AddRequest = await request.json();
|
||||
const { name, os, ip, url, cpu, gpu, ram, disk } = body;
|
||||
const { host, hostServer, name, os, ip, url, cpu, gpu, ram, disk } = body;
|
||||
|
||||
const server = await prisma.server.create({
|
||||
data: {
|
||||
host,
|
||||
hostServer,
|
||||
name,
|
||||
os,
|
||||
ip,
|
||||
|
||||
@ -2,6 +2,8 @@ import { NextResponse, NextRequest } from "next/server";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
interface EditRequest {
|
||||
host: boolean;
|
||||
hostServer: number;
|
||||
id: number;
|
||||
name: string;
|
||||
os: string;
|
||||
@ -16,7 +18,7 @@ interface EditRequest {
|
||||
export async function PUT(request: NextRequest) {
|
||||
try {
|
||||
const body: EditRequest = await request.json();
|
||||
const { id, name, os, ip, url, cpu, gpu, ram, disk } = body;
|
||||
const { host, hostServer, id, name, os, ip, url, cpu, gpu, ram, disk } = body;
|
||||
|
||||
const existingServer = await prisma.server.findUnique({ where: { id } });
|
||||
if (!existingServer) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user