diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-15 11:32:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-15 11:32:38 +0900 |
| commit | 557b238e88189e1314c39af82d77c94ba9dbd19e (patch) | |
| tree | 2014b2988fdc7ae90cce30159402ff3ac215725f /backend/main.go | |
| parent | a6b88139afc7c994ddb604757304d44214c00a90 (diff) | |
| download | phperkaigi-2026-albatross-557b238e88189e1314c39af82d77c94ba9dbd19e.tar.gz phperkaigi-2026-albatross-557b238e88189e1314c39af82d77c94ba9dbd19e.tar.zst phperkaigi-2026-albatross-557b238e88189e1314c39af82d77c94ba9dbd19e.zip | |
fix(backend): resolve TODO items for transactions, validation, and error 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>
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/main.go b/backend/main.go index ac996f0..01ed784 100644 --- a/backend/main.go +++ b/backend/main.go @@ -91,7 +91,7 @@ func main() { taskQueue := taskqueue.NewQueue("task-db:6379") workerServer := taskqueue.NewWorkerServer("task-db:6379") - gameHub := game.NewGameHub(queries, taskQueue, workerServer) + gameHub := game.NewGameHub(queries, connPool, taskQueue, workerServer) loginRL := ratelimit.NewIPRateLimiter(rate.Every(time.Minute/5), 5) @@ -99,10 +99,10 @@ func main() { apiGroup.Use(ratelimit.LoginRateLimitMiddleware(loginRL)) apiGroup.Use(api.SessionCookieMiddleware(queries)) apiGroup.Use(oapimiddleware.OapiRequestValidator(openAPISpec)) - apiHandler := api.NewHandler(queries, gameHub, conf) + apiHandler := api.NewHandler(queries, connPool, gameHub, conf) api.RegisterHandlers(apiGroup, api.NewStrictHandler(apiHandler, nil)) - adminHandler := admin.NewHandler(queries, conf) + adminHandler := admin.NewHandler(queries, connPool, conf) adminGroup := e.Group(conf.BasePath + "admin") adminGroup.Use(api.SessionCookieMiddleware(queries)) adminHandler.RegisterHandlers(adminGroup) |
