This commit is contained in:
2026-10-13 13:50:13 +07:00
parent e77cc34b4d
commit 57fee0cc06
26 changed files with 2202 additions and 181 deletions
+25 -4
View File
@@ -19,20 +19,39 @@ import (
// TeamService handles team operations.
type TeamService struct {
gamesRepo *games_repo.GamesRepo
teamsRepo *teams_repo.TeamsRepo
gamesRepo ITeamGamesRepository
teamsRepo ITeamsRepository
passwordGenerator password_generator.IPasswordGenerator
appBaseURL string
emailSender email_sender.IEmailSender
venueMode bool
receiptPrinter IReceiptPrinter
}
// ITeamGamesRepository reads games used by team operations.
type ITeamGamesRepository interface {
GetGameByID(context.Context, int) (*repos.Game, error)
}
// ITeamsRepository stores teams used by this service.
type ITeamsRepository interface {
GetTeamByID(context.Context, string) (*repos.Team, error)
GetActiveTeamsByGameID(context.Context, int) ([]*repos.Team, error)
AddTeamWithParticipation(context.Context, int, int, string, string, string, int32, bool) (string, error)
UpdateTeam(context.Context, string, string) error
DeleteTeam(context.Context, string) error
RegisterTeamWithParticipation(context.Context, int, string, string, string, int32, string, bool) (string, error)
}
// NewTeamService creates a team service.
func NewTeamService(
gamesRepo *games_repo.GamesRepo,
teamsRepo *teams_repo.TeamsRepo,
gamesRepo ITeamGamesRepository,
teamsRepo ITeamsRepository,
passwordGenerator password_generator.IPasswordGenerator,
appBaseURL string,
emailSender email_sender.IEmailSender,
venueMode bool,
receiptPrinter IReceiptPrinter,
) *TeamService {
return &TeamService{
gamesRepo: gamesRepo,
@@ -40,6 +59,8 @@ func NewTeamService(
passwordGenerator: passwordGenerator,
appBaseURL: appBaseURL,
emailSender: emailSender,
venueMode: venueMode,
receiptPrinter: receiptPrinter,
}
}