This commit is contained in:
2026-08-03 02:07:51 +07:00
parent 599c73bc08
commit 2492910e01
3 changed files with 8 additions and 15 deletions
+7 -7
View File
@@ -180,32 +180,32 @@ func (s *GameService) GiveTeamApplications(ctx context.Context, teamId int, name
return s.applicationsRepo.UpdateApplicationStatus(ctx, teamId, name, "done")
}
func (s *GameService) GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, error) {
func (s *GameService) GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, *Game, error) {
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
if err != nil {
return nil, err
return nil, nil, err
}
if team.Password != password {
return nil, teams_repo.ErrTeamNotFound
return nil, nil, teams_repo.ErrTeamNotFound
}
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
if err != nil {
return nil, err
return nil, nil, err
}
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
if err != nil {
return nil, err
return nil, nil, err
}
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
if err != nil {
return nil, err
return nil, nil, err
}
return s.storyteller.GetStory(scenario.Story, actions), nil
return s.storyteller.GetStory(scenario.Story, actions), mapGame(game, s.domain), nil
}
func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password string, actionCode string) error {