generated from VLADIMIR/template
fix
This commit is contained in:
+12
-36
@@ -40,9 +40,7 @@ func (s *server) AddGame(ctx context.Context, req *proto.AddGameReq) (*proto.Add
|
||||
req.Format,
|
||||
)
|
||||
if err != nil {
|
||||
return &proto.AddGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось создать игру")
|
||||
}
|
||||
|
||||
return &proto.AddGameRsp{
|
||||
@@ -64,9 +62,7 @@ func (s *server) DeleteGame(ctx context.Context, req *proto.DeleteGameReq) (*pro
|
||||
int(req.ID),
|
||||
)
|
||||
if err != nil {
|
||||
return &proto.DeleteGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось удалить игру")
|
||||
}
|
||||
|
||||
return &proto.DeleteGameRsp{}, nil
|
||||
@@ -83,9 +79,7 @@ func (s *server) GetGame(ctx context.Context, req *proto.GetGameReq) (*proto.Get
|
||||
|
||||
game, err := s.gameService.GetFullGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.GetGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось получить игру")
|
||||
}
|
||||
|
||||
return &proto.GetGameRsp{
|
||||
@@ -104,9 +98,7 @@ func (s *server) GetGameAnswers(ctx context.Context, req *proto.GetGameAnswersRe
|
||||
|
||||
gameAnswers, err := s.answerService.GetGameAnswers(ctx, int(req.GameID))
|
||||
if err != nil {
|
||||
return &proto.GetGameAnswersRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, answerErrorStatus(err, "не удалось получить ответы игры")
|
||||
}
|
||||
|
||||
return &proto.GetGameAnswersRsp{
|
||||
@@ -126,9 +118,7 @@ func (s *server) GetGameResults(ctx context.Context, req *proto.GetGameResultsRe
|
||||
|
||||
results, err := s.answerService.GetGameResults(ctx, int(req.GameID))
|
||||
if err != nil {
|
||||
return &proto.GetGameResultsRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, answerErrorStatus(err, "не удалось получить результаты игры")
|
||||
}
|
||||
|
||||
return &proto.GetGameResultsRsp{
|
||||
@@ -148,9 +138,7 @@ func (s *server) GetGames(ctx context.Context, req *proto.GetGamesReq) (*proto.G
|
||||
|
||||
games, err := s.gameService.GetGames(ctx)
|
||||
if err != nil {
|
||||
return &proto.GetGamesRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось получить игры")
|
||||
}
|
||||
|
||||
return &proto.GetGamesRsp{
|
||||
@@ -182,9 +170,7 @@ func (s *server) UpdateGame(ctx context.Context, req *proto.UpdateGameReq) (*pro
|
||||
req.Format,
|
||||
)
|
||||
if err != nil {
|
||||
return &proto.UpdateGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось изменить игру")
|
||||
}
|
||||
|
||||
return &proto.UpdateGameRsp{}, nil
|
||||
@@ -201,9 +187,7 @@ func (s *server) StartGame(ctx context.Context, req *proto.StartGameReq) (*proto
|
||||
|
||||
err := s.gameService.StartGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.StartGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось запустить игру")
|
||||
}
|
||||
|
||||
return &proto.StartGameRsp{}, nil
|
||||
@@ -220,9 +204,7 @@ func (s *server) PauseGame(ctx context.Context, req *proto.PauseGameReq) (*proto
|
||||
|
||||
err := s.gameService.PauseGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.PauseGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось приостановить игру")
|
||||
}
|
||||
|
||||
return &proto.PauseGameRsp{}, nil
|
||||
@@ -239,9 +221,7 @@ func (s *server) PlayGame(ctx context.Context, req *proto.PlayGameReq) (*proto.P
|
||||
|
||||
err := s.gameService.PlayGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.PlayGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось продолжить игру")
|
||||
}
|
||||
|
||||
return &proto.PlayGameRsp{}, nil
|
||||
@@ -258,9 +238,7 @@ func (s *server) FinishGame(ctx context.Context, req *proto.FinishGameReq) (*pro
|
||||
|
||||
err := s.gameService.FinishGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.FinishGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось завершить игру")
|
||||
}
|
||||
|
||||
return &proto.FinishGameRsp{}, nil
|
||||
@@ -277,9 +255,7 @@ func (s *server) ResetGame(ctx context.Context, req *proto.ResetGameReq) (*proto
|
||||
|
||||
err := s.gameService.ResetGame(ctx, int(req.ID))
|
||||
if err != nil {
|
||||
return &proto.ResetGameRsp{
|
||||
Error: err.Error(),
|
||||
}, nil
|
||||
return nil, gameErrorStatus(err, "не удалось сбросить игру")
|
||||
}
|
||||
|
||||
return &proto.ResetGameRsp{}, nil
|
||||
|
||||
Reference in New Issue
Block a user