Files
football-next/app/api/admin/matches/[id]/events/[eventId]/route.ts
2026-05-13 15:46:27 +03:30

13 lines
550 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { db } from "@/lib/db";
import { getApiUser } from "@/lib/apiAuth";
export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string; eventId: string }> }) {
const { eventId } = await params;
const apiUser = await getApiUser(req);
if (!apiUser || apiUser.role !== "ADMIN")
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
await db.matchEvent.delete({ where: { id: eventId } });
return NextResponse.json({ success: true });
}