Add paycheck tracking workflow for v1

This commit is contained in:
2026-03-23 12:45:24 -04:00
parent dec639ec16
commit f2854095f1
7 changed files with 274 additions and 8 deletions

View File

@@ -0,0 +1,23 @@
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;
}
}