generated from VLADIMIR/template
up
This commit is contained in:
@@ -50,11 +50,15 @@ func (s *TeamService) AddTeam(
|
||||
gameID int,
|
||||
name string,
|
||||
captainEmail string,
|
||||
participantsCount int32,
|
||||
) (*game_model.Team, error) {
|
||||
captainEmail = strings.TrimSpace(captainEmail)
|
||||
if captainEmail != "" && !validCaptainEmail(captainEmail) {
|
||||
return nil, ErrInvalidCaptainEmail
|
||||
}
|
||||
if participantsCount < 0 || participantsCount > 8 {
|
||||
return nil, ErrInvalidParticipantsCount
|
||||
}
|
||||
password, err := s.passwordGenerator.Generate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -66,7 +70,7 @@ func (s *TeamService) AddTeam(
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
id, err := s.teamsRepo.AddTeamWithParticipation(ctx, creatorID, gameID, name, password, captainEmail, !time.Now().Before(game.StartAt.Add(-24*time.Hour)))
|
||||
id, err := s.teamsRepo.AddTeamWithParticipation(ctx, creatorID, gameID, name, password, captainEmail, participantsCount, !time.Now().Before(game.StartAt.Add(-24*time.Hour)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user