This commit is contained in:
2026-09-17 13:32:05 +07:00
parent 5ba640bfe4
commit dfa4aa9d8b
9 changed files with 19 additions and 35 deletions
@@ -11,7 +11,6 @@ import (
"evening_detective_server/internal/modules/cleaner"
"evening_detective_server/internal/modules/password_generator"
"evening_detective_server/internal/modules/storytelling"
"evening_detective_server/internal/modules/team_qr_pdf"
"evening_detective_server/internal/repos/actions_repo"
"evening_detective_server/internal/repos/applications_repo"
"evening_detective_server/internal/repos/games_repo"
@@ -69,7 +68,7 @@ func TestServicesLifecyclePostgres(t *testing.T) {
textCleaner := cleaner.NewCleaner()
scenarioService := scenarios_service.NewScenarioService(scenarios, textCleaner, "https://files.test/", nil, nil)
game := game_service.NewGameService(games, teams, scenarios, scenarioService, "https://files.test/", actions, applications)
team := team_service.NewTeamService(games, teams, password_generator.NewGenerator(12), team_qr_pdf.NewGenerator(), "https://app.test")
team := team_service.NewTeamService(games, teams, password_generator.NewGenerator(12), "https://app.test")
play := gameplay_service.NewGameplayService(games, teams, scenarioService, storytelling.NewStory(textCleaner), actions, applications, textCleaner, "https://files.test/")
answers := answer_service.NewAnswerService(games, teams, scenarioService, team_answers_repo.NewTeamAnswersRepo(pool), actions)
participation := participation_service.NewParticipationService(teams, "https://app.test")
+2 -5
View File
@@ -16,7 +16,6 @@ type TeamService struct {
gamesRepo *games_repo.GamesRepo
teamsRepo *teams_repo.TeamsRepo
passwordGenerator password_generator.IPasswordGenerator
teamQRGenerator team_qr_pdf.IGenerator
appBaseURL string
}
@@ -24,14 +23,12 @@ func NewTeamService(
gamesRepo *games_repo.GamesRepo,
teamsRepo *teams_repo.TeamsRepo,
passwordGenerator password_generator.IPasswordGenerator,
teamQRGenerator team_qr_pdf.IGenerator,
appBaseURL string,
) *TeamService {
return &TeamService{
gamesRepo: gamesRepo,
teamsRepo: teamsRepo,
passwordGenerator: passwordGenerator,
teamQRGenerator: teamQRGenerator,
appBaseURL: appBaseURL,
}
}
@@ -102,12 +99,12 @@ func (s *TeamService) DownloadTeamQR(ctx context.Context, id int) ([]byte, strin
return nil, "", err
}
if len(teams) == 0 {
return nil, "", team_qr_pdf.ErrNoTeams
return nil, "", team_qr_pdf.ErrNoCards
}
cards, filename, err := teamQRData(s.appBaseURL, game, teams)
if err != nil {
return nil, "", err
}
data, err := s.teamQRGenerator.Generate(cards)
data, err := team_qr_pdf.Generate(cards)
return data, filename, err
}