generated from VLADIMIR/template
fix
This commit is contained in:
Binary file not shown.
@@ -623,7 +623,7 @@ func (s *server) GiveTeamApplications(ctx context.Context, req *proto.GiveTeamAp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) GetTeamStory(ctx context.Context, req *proto.GetTeamStoryReq) (*proto.GetTeamStoryRsp, error) {
|
func (s *server) GetTeamStory(ctx context.Context, req *proto.GetTeamStoryReq) (*proto.GetTeamStoryRsp, error) {
|
||||||
story, err := s.gameService.GetTeamActions(
|
story, game, err := s.gameService.GetTeamActions(
|
||||||
ctx,
|
ctx,
|
||||||
int(req.Id),
|
int(req.Id),
|
||||||
req.Password,
|
req.Password,
|
||||||
@@ -634,13 +634,6 @@ func (s *server) GetTeamStory(ctx context.Context, req *proto.GetTeamStoryReq) (
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
game, err := s.gameService.GetGame(ctx, int(req.Id))
|
|
||||||
if err != nil {
|
|
||||||
return &proto.GetTeamStoryRsp{
|
|
||||||
Error: err.Error(),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return &proto.GetTeamStoryRsp{
|
return &proto.GetTeamStoryRsp{
|
||||||
Story: mapStory(story),
|
Story: mapStory(story),
|
||||||
Game: mapGame(game),
|
Game: mapGame(game),
|
||||||
|
|||||||
@@ -180,32 +180,32 @@ func (s *GameService) GiveTeamApplications(ctx context.Context, teamId int, name
|
|||||||
return s.applicationsRepo.UpdateApplicationStatus(ctx, teamId, name, "done")
|
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)
|
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if team.Password != password {
|
if team.Password != password {
|
||||||
return nil, teams_repo.ErrTeamNotFound
|
return nil, nil, teams_repo.ErrTeamNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, game.ScenarioId)
|
||||||
if err != nil {
|
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 {
|
func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password string, actionCode string) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user