Backend: - fix(chat): ChatGateway stored the per-socket caller only after the async token check resolved, so a client that sent chat:join immediately on open raced ahead and got 4001. The caller is now stored as a promise that the message handlers await. Verified with a two-client send/receive E2E test against local Postgres. Client (client/app/): - Wahl screen gains a "Ergebnis" tab backed by GET /wahl/guest/results (PENDING / ASSIGNED with workshop + wish rank / UNASSIGNED). - Chat channel view loads history over REST, then connects the /chat WebSocket (chat_socket.dart): live chat:message stream + a compose bar that sends chat:send. Shows the socket status. - web_socket_channel dependency added. flutter analyze/test/build web all green; backend npm test 56. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
KC-App client (Flutter)
Single Flutter codebase for the KC-App platform. Web is the only target
enabled so far (flutter config --enable-web); Android/iOS/desktop can be
added later with flutter create --platforms=... in this directory — the
lib/ code is platform-agnostic.
Run
flutter pub get
flutter run -d chrome --dart-define=API_BASE=http://localhost:3000/api
API_BASE defaults to http://localhost:3000/api (the local NestJS
backend, which also serves the interim plain-HTML client at /).
What's implemented
- Login (
lib/screens/login_screen.dart) — three tabs:- Konfi / Gast: KC invite code + first/last name →
POST /auth/guest. - Team-Login: email + password for local Gemeinde Teamer →
POST /auth/team-login. (Leitungsteam / Verantwortliche use the Authentik Authorization-Code flow, not yet wired into this client.) - Einladung: redeem a Teamer invite token →
POST /auth/teamer/register.
- Konfi / Gast: KC invite code + first/last name →
- The token is stored via
shared_preferences(localStorage on web) and restored on start;GET /auth/meresolves the role for a role-aware home. - Home (
lib/screens/home_screen.dart) — identity card + navigation. - Workshop-Wahl (
lib/screens/wahl_screen.dart, guests) — loadsGET /wahl/guest/overview, tap workshops in order (max 3) to set priorities,POST /wahl/:id/teilnehmer. - Dateien (
lib/screens/files_screen.dart) —GET /files/:kcId, filtered server-side by the caller's visibility tier. - Chat (
lib/screens/chat_screen.dart) — channel + message list (read-only; sending is a WebSocket path, still to do).
Architecture
lib/api.dart—Api(thin REST wrapper + models) andAppState(ChangeNotifier: session, login/logout, token persistence).lib/main.dart—AppScope(anInheritedNotifier<AppState>) exposesAppScope.of(context);_AuthGateswitches Login/Home. No third-party state-management package.