generated from VLADIMIR/template
fix
This commit is contained in:
@@ -50,7 +50,7 @@ func (s *TeamService) AddTeam(
|
||||
) (*game_model.Team, error) {
|
||||
captainEmail = strings.TrimSpace(captainEmail)
|
||||
if captainEmail != "" && !validCaptainEmail(captainEmail) {
|
||||
return nil, errors.New("Укажите корректную почту капитана")
|
||||
return nil, ErrInvalidCaptainEmail
|
||||
}
|
||||
password, err := s.passwordGenerator.Generate()
|
||||
if err != nil {
|
||||
@@ -58,6 +58,9 @@ func (s *TeamService) AddTeam(
|
||||
}
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, gameID)
|
||||
if err != nil {
|
||||
if errors.Is(err, games_repo.ErrGameNotFound) {
|
||||
return nil, ErrGameNotFound
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id, err := s.teamsRepo.AddTeamWithParticipation(ctx, creatorID, gameID, name, password, captainEmail, !time.Now().Before(game.StartAt.Add(-24*time.Hour)))
|
||||
@@ -71,11 +74,19 @@ func (s *TeamService) AddTeam(
|
||||
}
|
||||
|
||||
func (s *TeamService) UpdateTeam(ctx context.Context, teamID int, name string) error {
|
||||
return s.teamsRepo.UpdateTeam(ctx, teamID, name)
|
||||
err := s.teamsRepo.UpdateTeam(ctx, teamID, name)
|
||||
if errors.Is(err, teams_repo.ErrTeamNotFound) {
|
||||
return ErrTeamNotFound
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TeamService) DeleteTeam(ctx context.Context, teamID int) error {
|
||||
return s.teamsRepo.DeleteTeam(ctx, teamID)
|
||||
err := s.teamsRepo.DeleteTeam(ctx, teamID)
|
||||
if errors.Is(err, teams_repo.ErrTeamNotFound) {
|
||||
return ErrTeamNotFound
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TeamService) RegisterTeam(ctx context.Context, gameID int, deliveryID string, registration Registration) (int, error) {
|
||||
|
||||
Reference in New Issue
Block a user