fix add team

This commit is contained in:
2026-07-29 00:59:37 +07:00
parent 1b3e0b768d
commit d1b263fa78
6 changed files with 46 additions and 10 deletions
+11 -5
View File
@@ -144,17 +144,23 @@ func (s *GameService) AddTeam(
creatorId int,
gameId int,
name string,
) error {
) (*Team, error) {
game, err := s.gamesRepo.GetGameByID(ctx, gameId)
if err != nil {
return err
return nil, err
}
password, err := s.passwordGenerator.Generate()
if err != nil {
return err
return nil, err
}
_, err = s.teamsRepo.AddTeam(ctx, creatorId, gameId, name, game.ScenarioId, password)
return err
id, err := s.teamsRepo.AddTeam(ctx, creatorId, gameId, name, game.ScenarioId, password)
if err != nil {
return nil, err
}
return &Team{
ID: id,
Password: password,
}, nil
}
func (s *GameService) UpdateTeam(ctx context.Context, teamId int, name string) error {