aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handler_wrapper.go
AgeCommit message (Collapse)Author
2026-02-21refactor(api): separate business logic into game, tournament, session packagesnsfisis
Extract business logic from api/handler.go into dedicated service packages: - session: context helpers (resolves admin → api import dependency) - game: game state, code submission, ranking, watch logic - tournament: bracket construction and seed ordering - api/convert.go: domain → API type conversion functions api/handler.go is now a thin adapter that delegates to services and maps domain errors to HTTP status codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20feat: allow viewing/spectating games without loginClaude
Make watch, ranking, game list, and tournament endpoints accessible without authentication. Unauthenticated users can browse games and spectate from the index page, while play/submit/preview still require login. https://claude.ai/code/session_019j9tNcnLsLz15e1qtbmeqe
2026-02-20feat: add user submission history pagensfisis
Allow users to view their own past submissions (code, size, status, timestamp) for each game. Adds API endpoint, backend handler, SQL query, and frontend page with expandable code display. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15refactor(backend): introduce DI interfaces for testabilitynsfisis
Replace concrete *db.Queries and *pgxpool.Pool dependencies with db.Querier and db.TxManager interfaces across all handlers, game hub, and auth. This enables unit testing with mocks. - Enable sqlc emit_interface to generate Querier interface - Add TxManager abstraction to encapsulate transactions - Convert auth package-level functions to Authenticator struct - Add TaskQueueInterface/TaskWorkerInterface for game.Hub - Add initial unit tests for game logic and API handlers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15fix(backend): resolve TODO items for transactions, validation, and error ↵nsfisis
handling - Wrap multi-step DB operations in transactions (signup, submit, game edit, task result processing) - Add game running checks to PostGamePlayCode and PostGamePlaySubmit - Hide ranking code when game is not yet finished - Replace silenced errors in processTaskResults with slog.Error logging - Add pgxpool.Pool to Handler/Hub structs for transaction support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15refactor(auth): replace JWT authentication with server-side sessionsnsfisis
Migrate from stateless JWT tokens to server-side session management backed by PostgreSQL. Sessions are hashed with SHA-256 before storage, cleaned up periodically, and invalidated on logout. This removes the need for JWT_SECRET/COOKIE_SECRET environment variables and the golang-jwt dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14feat(openapi): generate OpenAPI specs from TypeSpec sourcesnsfisis
Migrate hand-written OpenAPI YAML to TypeSpec (.tsp) source files. TypeSpec compiles to OpenAPI 3.0 YAML, enabling type-safe API definitions. - Add typespec/ directory with api-server and fortee definitions - Integrate TypeSpec build into `just gen` and `just build` pipelines - Update backend handler code to match new generated type names (inlined error responses, separate GameType/ProblemLanguage enums) - Regenerate frontend TypeScript types from new OpenAPI output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13feat(auth): store JWT in HTTP-only cookie instead of JS-accessible cookiensfisis
Prevent XSS-based token theft by making the JWT inaccessible to JavaScript. The backend now sets/clears the cookie via Set-Cookie headers, and the frontend retrieves user info from /api/me instead of decoding the JWT directly. - Add JWTCookieMiddleware to parse cookie and inject claims into context - Add /me and /logout endpoints to OpenAPI spec and handlers - Update PostLogin to return user object + Set-Cookie header - Replace Authorization header auth with cookie-based auth throughout - Rewrite frontend auth to use /api/me instead of jwt-decode - Remove jwt-decode dependency - Configure CORS with credentials for local dev Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13refactor: rename module/package namensfisis
2025-09-17feat(backend,frontend): implement tournament pagensfisis
2025-08-17feat: update "PHPerKaigi" to "iOSDC Japan"nsfisis
2025-03-08websocket to pollingnsfisis
2025-03-04update go package namesnsfisis
2024-08-08feat(backend): add `code_hash` to `submissions` tablensfisis
2024-08-08feat(backend/worker): enable `revive` in `golangci-lint`nsfisis
2024-08-08feat(backend/worker): enable `stylecheck` in `golangci-lint`nsfisis
2024-08-04chore: remove admin APIs to communicate between app-server and api-servernsfisis
2024-08-01refactor: simplify error responses in OpenAPI specnsfisis
2024-08-01refactor(backend): wrap ApiHandler with user authenticationnsfisis