mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
23 lines
593 B
TypeScript
23 lines
593 B
TypeScript
import { NextResponse, NextRequest } from "next/server";
|
|
import { PrismaClient } from '@/lib/generated/prisma'
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const body = await request.json();
|
|
const id = Number(body.id);
|
|
|
|
if (!id) {
|
|
return NextResponse.json({ error: "Missing ID" }, { status: 400 });
|
|
}
|
|
|
|
await prisma.server.delete({
|
|
where: { id: id }
|
|
});
|
|
|
|
return NextResponse.json({ success: true });
|
|
} catch (error: any) {
|
|
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
}
|
|
} |