generated from VLADIMIR/template
fix names
This commit is contained in:
@@ -45,12 +45,12 @@ func NewGameplayService(
|
||||
}
|
||||
}
|
||||
|
||||
func (s *GameplayService) GiveTeamApplications(ctx context.Context, teamId int, name string) error {
|
||||
return s.applicationsRepo.UpdateApplicationStatus(ctx, teamId, name, "done")
|
||||
func (s *GameplayService) GiveTeamApplications(ctx context.Context, teamID int, name string) error {
|
||||
return s.applicationsRepo.UpdateApplicationStatus(ctx, teamID, name, "done")
|
||||
}
|
||||
|
||||
func (s *GameplayService) GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, *game_model.Game, []actions_repo.Action, error) {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||
func (s *GameplayService) GetTeamActions(ctx context.Context, teamID int, password string) (*storytelling.Story, *game_model.Game, []actions_repo.Action, error) {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (s *GameplayService) GetTeamActions(ctx context.Context, teamId int, passwo
|
||||
return nil, nil, nil, teams_repo.ErrTeamNotFound
|
||||
}
|
||||
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -67,12 +67,12 @@ func (s *GameplayService) GetTeamActions(ctx context.Context, teamId int, passwo
|
||||
return &storytelling.Story{}, game_model.MapGame(game, s.domain), nil, nil
|
||||
}
|
||||
|
||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
@@ -86,8 +86,8 @@ func (s *GameplayService) GetTeamActions(ctx context.Context, teamId int, passwo
|
||||
return story, game_model.MapGame(game, s.domain), actions, nil
|
||||
}
|
||||
|
||||
func (s *GameplayService) AddTeamAction(ctx context.Context, teamId int, password string, actionCode string, viaMCP bool) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||
func (s *GameplayService) AddTeamAction(ctx context.Context, teamID int, password string, actionCode string, viaMCP bool) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -96,27 +96,27 @@ func (s *GameplayService) AddTeamAction(ctx context.Context, teamId int, passwor
|
||||
return teams_repo.ErrTeamNotFound
|
||||
}
|
||||
|
||||
_, err = s.actionsRepo.AddAction(ctx, teamId, actionCode, viaMCP)
|
||||
_, err = s.actionsRepo.AddAction(ctx, teamID, actionCode, viaMCP)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if team.ParticipationStatus == "pending" {
|
||||
if err := s.teamsRepo.ConfirmParticipationByFirstAction(ctx, teamId); err != nil {
|
||||
if err := s.teamsRepo.ConfirmParticipationByFirstAction(ctx, teamID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func (s *GameplayService) AddTeamAction(ctx context.Context, teamId int, passwor
|
||||
for _, application := range lastPlace.Applications {
|
||||
app := newApplication(application, s.domain)
|
||||
app.Name = s.cleaner.ClearText(app.Name)
|
||||
if _, err := s.applicationsRepo.AddApplication(ctx, teamId, app.Name, app.Image, app.FileType); err != nil {
|
||||
if _, err := s.applicationsRepo.AddApplication(ctx, teamID, app.Name, app.Image, app.FileType); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -140,23 +140,23 @@ func (s *GameplayService) AddTeamAction(ctx context.Context, teamId int, passwor
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *GameplayService) DeleteLastTeamAction(ctx context.Context, teamId int) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||
func (s *GameplayService) DeleteLastTeamAction(ctx context.Context, teamID int) error {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -170,10 +170,10 @@ func (s *GameplayService) DeleteLastTeamAction(ctx context.Context, teamId int)
|
||||
lastPlace := teamStory.Places[len(teamStory.Places)-1]
|
||||
|
||||
for _, application := range lastPlace.Applications {
|
||||
if err := s.applicationsRepo.DeleteApplicationByTeamIdAndName(ctx, teamId, application.Name); err != nil {
|
||||
if err := s.applicationsRepo.DeleteApplicationByTeamIDAndName(ctx, teamID, application.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return s.actionsRepo.DeleteLastActionByTeamId(ctx, teamId)
|
||||
return s.actionsRepo.DeleteLastActionByTeamID(ctx, teamID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user