Files
Flight-Ops/app/api/packages/[id]/abandon/route.ts

14 lines
686 B
TypeScript

import { abandonPackage, performAction } from '@/lib/game/actions';
// POST /api/packages/:id/abandon (v0.12.0) — no body. Drops a LOADED (or already
// EXPIRED) package while its plane is GROUNDED: cash -= penalty (15% of the payout
// at creation scaling to 60% at the deadline; expired packages cost nothing, cash
// floors at €0), the package becomes "abandoned" and frees its slot. 404 unknown
// id; 409 wrong status or the plane is in flight. On success returns the full
// state snapshot.
export async function POST(_req: Request, ctx: { params: Promise<{ id: string }> }) {
const { id } = await ctx.params;
return performAction((inst) => abandonPackage(inst, id));
}