generated from VLADIMIR/template
add mcp label
This commit is contained in:
@@ -206,32 +206,36 @@ 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, *Game, error) {
|
||||
func (s *GameService) GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, *Game, []actions_repo.Action, error) {
|
||||
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
if team.Password != password {
|
||||
return nil, nil, teams_repo.ErrTeamNotFound
|
||||
return nil, nil, nil, teams_repo.ErrTeamNotFound
|
||||
}
|
||||
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
return s.storyteller.GetStory(scenario.Story, actions), mapGame(game, s.domain), nil
|
||||
codes := make([]string, len(actions))
|
||||
for i, action := range actions {
|
||||
codes[i] = action.Code
|
||||
}
|
||||
return s.storyteller.GetStory(scenario.Story, codes), mapGame(game, s.domain), actions, nil
|
||||
}
|
||||
|
||||
func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password string, actionCode string, viaMCP bool) error {
|
||||
@@ -254,7 +258,7 @@ func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password st
|
||||
return err
|
||||
}
|
||||
|
||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -264,6 +268,10 @@ func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password st
|
||||
return err
|
||||
}
|
||||
|
||||
actions := make([]string, len(actionDetails))
|
||||
for i, action := range actionDetails {
|
||||
actions[i] = action.Code
|
||||
}
|
||||
teamStory := s.storyteller.GetStory(scenario.Story, actions)
|
||||
|
||||
lastPlace := teamStory.Places[len(teamStory.Places)-1]
|
||||
@@ -290,7 +298,7 @@ func (s *GameService) DeleteLastTeamAction(ctx context.Context, teamId int) erro
|
||||
return err
|
||||
}
|
||||
|
||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
actionDetails, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -300,6 +308,10 @@ func (s *GameService) DeleteLastTeamAction(ctx context.Context, teamId int) erro
|
||||
return err
|
||||
}
|
||||
|
||||
actions := make([]string, len(actionDetails))
|
||||
for i, action := range actionDetails {
|
||||
actions[i] = action.Code
|
||||
}
|
||||
teamStory := s.storyteller.GetStory(scenario.Story, actions)
|
||||
|
||||
lastPlace := teamStory.Places[len(teamStory.Places)-1]
|
||||
|
||||
Reference in New Issue
Block a user