2025-04-11 22:55:17 +02:00
|
|
|
import { NextResponse, NextRequest } from "next/server";
|
2025-04-13 21:10:17 +02:00
|
|
|
import { prisma } from "@/lib/prisma";
|
2025-04-11 22:55:17 +02:00
|
|
|
|
|
|
|
|
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.application.delete({
|
|
|
|
|
where: { id: id }
|
|
|
|
|
});
|
|
|
|
|
|
2025-04-15 14:10:16 +02:00
|
|
|
await prisma.uptime_history.deleteMany({
|
|
|
|
|
where: { applicationId: id }
|
|
|
|
|
});
|
|
|
|
|
|
2025-04-11 22:55:17 +02:00
|
|
|
return NextResponse.json({ success: true });
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
|
|
|
}
|
|
|
|
|
}
|