From 557b238e88189e1314c39af82d77c94ba9dbd19e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 15 Feb 2026 11:32:38 +0900 Subject: 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 --- backend/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'backend/main.go') 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) -- cgit v1.3.1