import { NextResponse } from "next/server"; import { requirePlatformRole } from "@/lib/session"; import { removeSkillPricing } from "@/lib/db"; import { safeError } from "@/lib/errors"; /** * DELETE /api/admin/billing/skill-pricing/[skill] * Remove pricing for a skill. Toggle events continue to be * recorded; the skill simply becomes free starting from the next * generated invoice. Historical invoices already issued are * unaffected (they carry frozen line amounts). */ export async function DELETE( _request: Request, { params }: { params: Promise<{ skill: string }> } ) { try { await requirePlatformRole(); } catch { return NextResponse.json({ error: "Forbidden" }, { status: 403 }); } const { skill } = await params; try { await removeSkillPricing(skill); return NextResponse.json({ message: "Removed." }); } catch (e) { console.error("Failed to remove skill pricing:", e); return NextResponse.json( { error: safeError(e, "Remove failed") }, { status: 500 } ); } }