mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
22 lines
561 B
TypeScript
22 lines
561 B
TypeScript
|
|
import { NextRequest, NextResponse } from "next/server";
|
||
|
|
import prisma from "@/app/prisma";
|
||
|
|
|
||
|
|
interface Body {
|
||
|
|
siteId: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function DELETE(request: NextRequest) {
|
||
|
|
const body: Body = await request.json();
|
||
|
|
const { siteId } = body;
|
||
|
|
|
||
|
|
try {
|
||
|
|
const site = await prisma.site.delete({
|
||
|
|
where: { id: Number(siteId) },
|
||
|
|
});
|
||
|
|
|
||
|
|
return NextResponse.json(site);
|
||
|
|
} catch (error) {
|
||
|
|
console.error(error);
|
||
|
|
return NextResponse.json({ error: "Failed to delete site" }, { status: 500 });
|
||
|
|
}
|
||
|
|
}
|