summaryrefslogtreecommitdiff
path: root/player-server/internal/api/server.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-21 00:18:29 +0300
committerPaul Buetow <paul@buetow.org>2026-05-21 00:18:29 +0300
commit893e2aca022e6e9d72019a80b866334a777f60cc (patch)
tree9814363334da3f674b0079b8ce66e52589b8724b /player-server/internal/api/server.go
parent89ef249a43ce1edcd8a3e217542de8f31c1a4c15 (diff)
Add GET /api/v1/auth/count endpoint and first-run routing in Android app
Server: expose a public countUsers endpoint (GET /api/v1/auth/count) so mobile clients can detect first-run (count=0) without a session. Android: wire countUsers via DioPlayerApiClient, add firstRunProvider (FutureProvider), update go_router redirect to drive /bootstrap vs /login based on the count, rework LoginScreen to handle loading/error states, and add widget tests for the new login screen and smoke-test updates. Fix review issues: correct FutureProvider cache-lifetime comment in first_run_provider.dart; add TestServer_CountUsers covering zero-users and users-exist cases to handlers_test.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'player-server/internal/api/server.go')
-rw-r--r--player-server/internal/api/server.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/player-server/internal/api/server.go b/player-server/internal/api/server.go
index fa2ca74..e87c532 100644
--- a/player-server/internal/api/server.go
+++ b/player-server/internal/api/server.go
@@ -225,6 +225,9 @@ func (s *Server) routesPublic() {
s.handlePublicFunc("/api/v1/auth/bootstrap", publicMethod(http.MethodPost, s.handleBootstrap))
s.handlePublicFunc("/api/login", publicMethod(http.MethodPost, s.handleLogin))
s.handlePublicFunc("/api/v1/auth/login", publicMethod(http.MethodPost, s.handleLogin))
+ // Public user-count endpoint: mobile clients query this on first launch to
+ // decide whether to show the bootstrap screen (count=0) or the login screen.
+ s.handlePublicFunc("/api/v1/auth/count", publicMethod(http.MethodGet, s.handleCountUsers))
s.handlePublicFunc("/healthz", publicMethod(http.MethodGet, s.handleHealthz))
s.handlePublicFunc("/readyz", publicMethod(http.MethodGet, s.handleReadyz))
}