generated from VLADIMIR/template
fix
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"evening_detective_server/internal/services/game_model"
|
||||
)
|
||||
|
||||
// TeamService handles team operations.
|
||||
type TeamService struct {
|
||||
gamesRepo *games_repo.GamesRepo
|
||||
teamsRepo *teams_repo.TeamsRepo
|
||||
@@ -25,6 +26,7 @@ type TeamService struct {
|
||||
emailSender email_sender.IEmailSender
|
||||
}
|
||||
|
||||
// NewTeamService creates a team service.
|
||||
func NewTeamService(
|
||||
gamesRepo *games_repo.GamesRepo,
|
||||
teamsRepo *teams_repo.TeamsRepo,
|
||||
@@ -41,6 +43,7 @@ func NewTeamService(
|
||||
}
|
||||
}
|
||||
|
||||
// AddTeam creates a team.
|
||||
func (s *TeamService) AddTeam(
|
||||
ctx context.Context,
|
||||
creatorID int,
|
||||
@@ -73,6 +76,7 @@ func (s *TeamService) AddTeam(
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdateTeam changes a team's name.
|
||||
func (s *TeamService) UpdateTeam(ctx context.Context, teamID int, name string) error {
|
||||
err := s.teamsRepo.UpdateTeam(ctx, teamID, name)
|
||||
if errors.Is(err, teams_repo.ErrTeamNotFound) {
|
||||
@@ -81,6 +85,7 @@ func (s *TeamService) UpdateTeam(ctx context.Context, teamID int, name string) e
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteTeam removes a team.
|
||||
func (s *TeamService) DeleteTeam(ctx context.Context, teamID int) error {
|
||||
err := s.teamsRepo.DeleteTeam(ctx, teamID)
|
||||
if errors.Is(err, teams_repo.ErrTeamNotFound) {
|
||||
@@ -89,6 +94,7 @@ func (s *TeamService) DeleteTeam(ctx context.Context, teamID int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// RegisterTeam registers a team for a game.
|
||||
func (s *TeamService) RegisterTeam(ctx context.Context, gameID int, deliveryID string, registration Registration) (int, error) {
|
||||
if err := registration.Validate(); err != nil {
|
||||
return 0, err
|
||||
@@ -133,6 +139,7 @@ func registrationEmail(team *repos.Team, gameName, baseURL string) email_sender.
|
||||
return email_sender.Message{To: team.CaptainEmail, Subject: "Регистрация команды в «Вечернем детективе»", Body: body, HTML: markup}
|
||||
}
|
||||
|
||||
// DownloadTeamQR returns a PDF with team QR codes.
|
||||
func (s *TeamService) DownloadTeamQR(ctx context.Context, id int) ([]byte, string, error) {
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user