import { Prisma } from "@prisma/client"; import { NextResponse } from "next/server"; import { removePaycheck } from "@/lib/paychecks"; type RouteContext = { params: Promise<{ id: string }>; }; export async function DELETE(_: Request, context: RouteContext) { const { id } = await context.params; try { await removePaycheck(id); return new NextResponse(null, { status: 204 }); } catch (error) { if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === "P2025") { return NextResponse.json({ error: "Paycheck not found." }, { status: 404 }); } throw error; } }