aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api
AgeCommit message (Collapse)Author
2026-02-28feat(admin): allow admin users to view and submit code before game startsnsfisis
Admin users can now access the gaming UI (problem description, code editor, submit button) even when a game has not started yet. Regular users still see the waiting screen as before. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21refactor: rename stuttering exported types in game and tournament packagesnsfisis
Fix golangci-lint revive warnings by removing package name prefixes: - game.GameHubInterface → game.HubInterface - game.GameDetail → game.Detail - tournament.TournamentEntry → tournament.Entry - tournament.TournamentMatch → tournament.Match - tournament.TournamentBracket → tournament.Bracket - tournament.TournamentEditData → tournament.EditData Also fix gofmt alignment in api/convert.go and gosimple S1016 in game/service.go. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21refactor(admin): separate business logic into game and tournament servicesnsfisis
Move transaction handling, rejudge workflow, tournament bracket creation, and data repair logic from admin handler into game.Service and tournament.Service, mirroring the earlier api package separation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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-20style(backend): modernize Go syntax with range-over-int and type inferencensfisis
Use Go 1.22+ range-over-integer syntax, replace interface{} with any, and remove redundant type parameters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20feat(auth): add structured logging for login success and failurensfisis
Add ClientIPMiddleware to extract client IP into context.Context, enabling structured log output with username, IP, and failure reason for login attempts. Change failed login log level from Error to Warn as authentication failures are expected events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18feat: refactor tournament to generic DB-backed N-person bracketnsfisis
Replace hardcoded 6-person tournament with a generic single-elimination bracket system backed by new DB tables (tournaments, tournament_entries, tournament_matches). Includes admin CRUD, standard seeding algorithm, bye handling, and a CSS Grid bracket renderer on the frontend. Add comprehensive tests for backend API/admin handlers, seeding logic, and frontend bracket component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16test(backend): add unit tests for auth_middleware, fortee, processor, ↵nsfisis
account, and more handlers Cover previously untested code: SessionCookieMiddleware, context helpers, downloadFile, addAcceptHeader, doProcessTaskRunTestcase, updateSubmissionAndGameState, PostLogout, GetGames, PostGamePlayCode, GetGameWatchRanking, GetGameWatchLatestStates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16test(backend): add unit tests for admin handlers and taskqueuensfisis
Add comprehensive tests for previously untested packages: - admin: middleware auth checks, CRUD handlers for users/games/problems/testcases - taskqueue: task creation, payload serialization, code hash calculation - api: expose SetUserInContext helper for cross-package test support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16style(backend): fix lint errors in test filesnsfisis
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16test(backend): add unit tests for auth, config, ratelimit, game, and apinsfisis
Cover previously untested logic: session ID generation/hashing, password authentication, IP rate limiting, game state helpers, handler endpoints, task enqueue/result processing, and config loading. 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(log): migrate from log to log/slog for structured loggingnsfisis
Replace all usages of the standard log package with log/slog across backend and swift worker. Configure Echo's request logger to emit structured log attributes via slog instead of the default format. 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-14feat(backend): update dependenciesnsfisis
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-19feat(backend): allow admin to access private gamesnsfisis
2025-09-17feat(backend,frontend): implement tournament pagensfisis
2025-09-06fix(*): support compile_error as worker resultnsfisis
2025-09-06feat(backend): add admin page for problemsnsfisis
2025-09-05feat(backend): support swift languagensfisis
2025-08-17feat: update "PHPerKaigi" to "iOSDC Japan"nsfisis
2025-03-29feat: show code in ranking pagensfisis
2025-03-21feat(frontend): do not transit to finished pagensfisis
2025-03-21fix(frontend): fix submission status flickeringnsfisis
2025-03-21feat(frontend): show game result in 1v1 watchnsfisis
2025-03-20feat: show submission date on rankingnsfisis
2025-03-15feat(backend): allow admin to watch themselves 1v1 pagensfisis
2025-03-11refactor(backend): simplify conversion from *T to Nullable[T]nsfisis
2025-03-11feat: show user labelnsfisis
2025-03-08fixnsfisis
2025-03-08fixnsfisis
2025-03-08websocket to pollingnsfisis
2025-03-04rm registration tokennsfisis
2025-03-04update go package namesnsfisis
2024-08-12feat: show left time in play pagensfisis
2024-08-12feat: add `submitresult` messagensfisis
2024-08-12refactor: rename verification_steps for consistant namingnsfisis
2024-08-12feat: do not show preliminary scorensfisis
2024-08-11feat: simplify starting procedurensfisis
2024-08-11feat(backend): remove `prepare` message's payloadnsfisis
2024-08-11feat(backend): always include `problem` property in `Game` object in APIsnsfisis
2024-08-11feat(backend): make `games.problem_id` non-nullnsfisis
2024-08-11feat(frontend): improve error handling of login formnsfisis
2024-08-10feat: extends watcher message typesnsfisis