generated from VLADIMIR/template
add game to team story
This commit is contained in:
@@ -482,7 +482,7 @@ func (s *server) GetGame(ctx context.Context, req *proto.GetGameReq) (*proto.Get
|
||||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
|
||||
game, err := s.gameService.GetGame(ctx, int(req.Id))
|
||||
game, err := s.gameService.GetFullGame(ctx, int(req.Id))
|
||||
if err != nil {
|
||||
return &proto.GetGameRsp{
|
||||
Error: err.Error(),
|
||||
@@ -634,8 +634,16 @@ func (s *server) GetTeamStory(ctx context.Context, req *proto.GetTeamStoryReq) (
|
||||
}, nil
|
||||
}
|
||||
|
||||
game, err := s.gameService.GetGame(ctx, int(req.Id))
|
||||
if err != nil {
|
||||
return &proto.GetTeamStoryRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
return &proto.GetTeamStoryRsp{
|
||||
Story: mapStory(story),
|
||||
Game: mapGame(game),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,16 @@ func (s *GameService) AddGame(
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (s *GameService) GetGame(
|
||||
func (s *GameService) GetGame(ctx context.Context, id int) (*Game, error) {
|
||||
game, err := s.gamesRepo.GetGameByID(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res := mapGame(game, s.domain)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *GameService) GetFullGame(
|
||||
ctx context.Context,
|
||||
id int,
|
||||
) (*Game, error) {
|
||||
|
||||
Reference in New Issue
Block a user