generated from VLADIMIR/template
up
This commit is contained in:
@@ -166,3 +166,18 @@ func (s *TeamService) DownloadTeamQR(ctx context.Context, id int) ([]byte, strin
|
||||
data, err := team_qr_pdf.Generate(cards)
|
||||
return data, filename, err
|
||||
}
|
||||
|
||||
// CheckPresence validates team credentials without loading game progress or a scenario.
|
||||
func (s *TeamService) CheckPresence(ctx context.Context, teamID int, password string) (int, error) {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if errors.Is(err, teams_repo.ErrTeamNotFound) {
|
||||
return 0, ErrTeamNotFound
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if team.Password != password || team.ParticipationStatus == "cancelled" {
|
||||
return 0, ErrTeamNotFound
|
||||
}
|
||||
return team.GameID, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user