feat(api): GET /api/missions + POST /api/missions/{id}/accept
Routes call ensureSave first (mission functions assume an initialized save), map MissionError to 404/409 and non-integer path ids to 400. OpenAPI spec in code gains both paths + the Mission schema (12 -> 14 paths); openapi.test.ts covers the new shapes.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { getGameDb } from '@/lib/db/client'
|
||||
import { ensureSave } from '@/lib/game/save'
|
||||
import { getMissions } from '@/lib/game/missions'
|
||||
|
||||
// The full mission board for the single active save; auto-initializes on first hit.
|
||||
export async function GET() {
|
||||
const db = await getGameDb()
|
||||
await ensureSave(db) // top-up inside getMissions assumes a save exists
|
||||
return Response.json(await getMissions(db))
|
||||
}
|
||||
Reference in New Issue
Block a user