From 642d3b4e1d33afd521f315b9aa99b8993d252902 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 21 Feb 2026 10:46:02 +0900 Subject: refactor(admin): separate business logic into game and tournament services 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 --- backend/api/handler_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backend/api') diff --git a/backend/api/handler_test.go b/backend/api/handler_test.go index 2b8c06a..a4e08dc 100644 --- a/backend/api/handler_test.go +++ b/backend/api/handler_test.go @@ -160,7 +160,7 @@ func newTestHandler(q *mockQuerier) Handler { hub := &mockGameHub{} return Handler{ gameSvc: game.NewService(q, &mockTxManager{}, hub), - tournamentSvc: tournament.NewService(q), + tournamentSvc: tournament.NewService(q, &mockTxManager{}), auth: &mockAuthenticator{}, conf: &config.Config{}, q: q, @@ -170,7 +170,7 @@ func newTestHandler(q *mockQuerier) Handler { func newTestHandlerWithHub(q *mockQuerier, hub *mockGameHub) Handler { return Handler{ gameSvc: game.NewService(q, &mockTxManager{}, hub), - tournamentSvc: tournament.NewService(q), + tournamentSvc: tournament.NewService(q, &mockTxManager{}), auth: &mockAuthenticator{}, conf: &config.Config{}, q: q, @@ -443,7 +443,7 @@ func TestGetGame_PublicGameSuccess(t *testing.T) { func TestPostLogin_AuthFailure(t *testing.T) { h := Handler{ gameSvc: game.NewService(&mockQuerier{}, &mockTxManager{}, &mockGameHub{}), - tournamentSvc: tournament.NewService(&mockQuerier{}), + tournamentSvc: tournament.NewService(&mockQuerier{}, &mockTxManager{}), auth: &mockAuthenticator{loginErr: errors.New("invalid credentials")}, conf: &config.Config{}, q: &mockQuerier{}, @@ -462,7 +462,7 @@ func TestPostLogin_AuthFailure(t *testing.T) { func TestPostLogout(t *testing.T) { h := Handler{ gameSvc: game.NewService(&mockQuerier{}, &mockTxManager{}, &mockGameHub{}), - tournamentSvc: tournament.NewService(&mockQuerier{}), + tournamentSvc: tournament.NewService(&mockQuerier{}, &mockTxManager{}), auth: &mockAuthenticator{}, conf: &config.Config{BasePath: "/"}, q: &mockQuerier{}, -- cgit v1.3.1