- docs/PLAYER-STATUS-HTTP.md vollstaendig neu strukturiert: q=, derived_state=, DELETE-Endpoint und Datei-Persistenz ergaenzt, Abgrenzung "keine dauerhafte Speicherung" entfernt - GET /api/v1 listet jetzt dieselben 5 Tools wie /api/v1/meta (player-status-ingest und screen-status-delete ergaenzt) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package httpapi
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func NewRouter(store playerStatusStore) http.Handler {
|
|
mux := http.NewServeMux()
|
|
|
|
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, _ *http.Request) {
|
|
writeJSON(w, http.StatusOK, map[string]string{
|
|
"status": "ok",
|
|
"service": "morz-infoboard-backend",
|
|
})
|
|
})
|
|
|
|
mux.HandleFunc("GET /status", handleStatusPage(store))
|
|
mux.HandleFunc("GET /status/{screenId}", handleScreenDetailPage(store))
|
|
|
|
mux.HandleFunc("GET /api/v1", func(w http.ResponseWriter, _ *http.Request) {
|
|
writeJSON(w, http.StatusOK, map[string]any{
|
|
"name": "morz-infoboard-backend",
|
|
"version": "dev",
|
|
"tools": []string{
|
|
"message-wall-resolve",
|
|
"screen-status-list",
|
|
"screen-status-detail",
|
|
"player-status-ingest",
|
|
"screen-status-delete",
|
|
},
|
|
})
|
|
})
|
|
|
|
mux.HandleFunc("GET /api/v1/meta", handleMeta)
|
|
|
|
mux.HandleFunc("POST /api/v1/player/status", handlePlayerStatus(store))
|
|
mux.HandleFunc("GET /api/v1/screens/status", handleListLatestPlayerStatuses(store))
|
|
mux.HandleFunc("GET /api/v1/screens/{screenId}/status", handleGetLatestPlayerStatus(store))
|
|
mux.HandleFunc("DELETE /api/v1/screens/{screenId}/status", handleDeletePlayerStatus(store))
|
|
|
|
mux.HandleFunc("POST /api/v1/tools/message-wall/resolve", handleResolveMessageWall)
|
|
|
|
return mux
|
|
}
|