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
+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
}