Files
Flight-Ops/app/api/planes/[planeId]/repair/route.ts
T
2026-09-26 14:40:56 +00:00

13 lines
702 B
TypeScript

import { performAction, repairPlane } from '@/lib/game/actions';
// POST /api/planes/:planeId/repair (v0.39.0, ISS-069) — no body. Grounds a worn-out plane in
// "repairing" status for the flat REPAIR_COST; its health climbs back to 100 over 3 sim days and
// the engine's tick flips it to "available" exactly when full (v0.45.0, ISS-089). A full-health
// repair is a free no-op (cost 0). 404 unknown id; 409 plane not grounded or insufficient funds.
// On success returns the full state snapshot.
export async function POST(req: Request, ctx: { params: Promise<{ planeId: string }> }) {
const { planeId } = await ctx.params;
return performAction(req, (inst) => repairPlane(inst, planeId));
}