mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
feat(api): add v2 routes, auth middleware, structured errors, and server status endpoint
Introduces incremental API improvements for custom launcher support (mhf-iel, stratic-dev's Rust launcher): - Standardize all error responses to JSON envelopes with error/message - Add Bearer token auth middleware for v2 routes (legacy body-token preserved) - Add `returning` (>90d inactive) and `courses` fields to auth response - Add /v2/ route prefix with HTTP method enforcement - Add GET /v2/server/status for MezFes, featured weapon, and event status - Add APIEventRepo for read-only event data access Closes #44
This commit is contained in:
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- API: Standardized JSON error responses (`{"error":"...","message":"..."}`) across all endpoints via `writeError` helper
|
||||
- API: Auth middleware extracting `Authorization: Bearer <token>` header for v2 routes; legacy body-token auth preserved
|
||||
- API: `returning` field on characters (true if last login > 90 days ago) and `courses` field on auth data (derived from user rights)
|
||||
- API: `/v2/` route prefix with HTTP method enforcement alongside legacy routes
|
||||
- API: `GET /v2/server/status` endpoint returning MezFes schedule, featured weapon, and festa/diva event status
|
||||
- API: `APIEventRepo` interface and read-only implementation for feature weapons and events
|
||||
- Catch-up migration (`0002_catch_up_patches.sql`) for databases with partially-applied patch schemas — idempotent no-op on fresh or fully-patched databases, fills gaps for partial installations
|
||||
- Embedded auto-migrating database schema system (`server/migrations/`): the server binary now contains all SQL schemas and runs migrations automatically on startup — no more `pg_restore`, manual patch ordering, or external `schemas/` directory needed
|
||||
- Setup wizard: web-based first-run configuration at `http://localhost:8080` when `config.json` is missing — guides users through database connection, schema initialization, and server settings
|
||||
|
||||
Reference in New Issue
Block a user