aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/main.go
AgeCommit message (Collapse)Author
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(admin): integrate asynqmon web UI for task queue monitoringnsfisis
Mount asynqmon HTTP handler under admin/queue with existing session cookie and admin middleware authentication. 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-20feat(admin): add rejudge functionality for submissionsnsfisis
Allow administrators to re-execute test cases for a specific submission from the submission detail page. This is useful after testcase fixes or worker issues. 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(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-13feat(auth): add login rate limiting per IPnsfisis
Prevent brute-force attacks by limiting POST /login to 5 requests per minute per IP address using golang.org/x/time/rate. Unused entries are cleaned up after 10 minutes of inactivity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13refactor: rename module/package namensfisis
2025-08-17feat: update "PHPerKaigi" to "iOSDC Japan"nsfisis
2025-08-14feat(backend,frontend): Replace hard-coded base path with environment variablensfisis
2025-03-17refactor(backend): remove unused fieldnsfisis
2025-03-11refactor(backend): remove unnecessary commentsnsfisis
2025-03-08websocket to pollingnsfisis
2025-03-04change base pathnsfisis
2025-03-04update go package namesnsfisis
2024-08-18feat(backend): do not define local-only routes in prod envnsfisis
2024-08-18feat(backend): forward all unknown requests to app server in local envnsfisis
2024-08-17feat(backend): fetch user icon from forteensfisis
2024-08-10fix(backend): fix base path of login/logout pages on local envnsfisis
2024-08-10feat: prepend base pathnsfisis
2024-08-08feat(backend/worker): enable `revive` in `golangci-lint`nsfisis
2024-08-08feat(backend/worker): enable `stylecheck` in `golangci-lint`nsfisis
2024-08-08feat(backend/woerker): enable `errcheck` in `golangci-lint`nsfisis
2024-08-08refactor(backend): move ownership of channel to send task resultsnsfisis
2024-08-05feat: show execution result in play pagensfisis
2024-08-05feat(backend): implement task queue processornsfisis
2024-08-05feat: implement task queuensfisis
2024-08-04feat: authenticate users in admin pagesnsfisis
2024-08-04feat(backend): add /logout to /admin/dashboardnsfisis
2024-08-04feat(backend): serve /admin/* pages from api-servernsfisis
2024-08-01refactor(backend): `Id` to `ID` in echo path paramsnsfisis
2024-08-01refactor(backend): wrap ApiHandler with user authenticationnsfisis
2024-08-01feat: change procedure of game startingnsfisis
2024-07-31feat: "iOSDC 2024" to "iOSDC Japan 2024"nsfisis
2024-07-29feat(backend): partially implement gamingnsfisis
2024-07-29feat(backend): use connection poolnsfisis
2024-07-28refactor(backend): move game-related code to game modulensfisis
2024-07-28refactor(backend): move config-related code to config.gonsfisis
2024-07-28chore(backend): rename root modulensfisis
2024-07-28refactor: remove /api/ prefix from openapi.yamlnsfisis
2024-07-28feat(backend): user Logger and Recover middlewarensfisis
2024-07-28feat(backend): handle JWT validation manuallynsfisis
2024-07-28backend: openapinsfisis
2024-07-27backend: jwtnsfisis
2024-07-27organize dockerfiles and compose.yamlnsfisis