This commit is contained in:
2026-09-17 01:55:28 +07:00
parent 92e4fdd139
commit 49fe193ed7
5 changed files with 58 additions and 39 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ func participationError(err error) string {
}
func (s *server) GetParticipation(ctx context.Context, req *proto.GetParticipationReq) (*proto.ParticipationRsp, error) {
_ = grpc.SetHeader(ctx, metadata.Pairs("Cache-Control", "no-store"))
p, err := s.gameService.GetParticipation(ctx, req.Token)
p, err := s.participationService.GetParticipation(ctx, req.Token)
result := mapParticipationResponse(p)
if err != nil {
result.Error = participationError(err)
@@ -43,7 +43,7 @@ func (s *server) AnswerParticipation(ctx context.Context, req *proto.AnswerParti
if req.Answer != "confirmed" && req.Answer != "cancelled" {
return &proto.ParticipationRsp{Error: "Выберите подтверждение или отмену участия"}, nil
}
p, err := s.gameService.AnswerParticipation(ctx, req.Token, req.Answer)
p, err := s.participationService.AnswerParticipation(ctx, req.Token, req.Answer)
result := mapParticipationResponse(p)
if err != nil {
result.Error = participationError(err)
+18 -14
View File
@@ -6,6 +6,7 @@ import (
"evening_detective_server/internal/repos/screen_sessions_repo"
"evening_detective_server/internal/services/file_service"
"evening_detective_server/internal/services/game_service"
"evening_detective_server/internal/services/participation_service"
"evening_detective_server/internal/services/scenarios_service"
"evening_detective_server/internal/services/ui_service"
"evening_detective_server/internal/services/users_service"
@@ -18,13 +19,14 @@ var stringTools = string_tools.NewStringTools()
type server struct {
proto.UnsafeEveningDetectiveServerServer
usersService *users_service.UsersService
uiService *ui_service.UiService
fileService *file_service.FileService
scenarioService *scenarios_service.ScenarioService
gameService *game_service.GameService
screenRepo *screen_sessions_repo.ScreenSessionsRepo
mapRepo *game_map_repo.Repo
usersService *users_service.UsersService
uiService *ui_service.UiService
fileService *file_service.FileService
scenarioService *scenarios_service.ScenarioService
gameService *game_service.GameService
participationService *participation_service.ParticipationService
screenRepo *screen_sessions_repo.ScreenSessionsRepo
mapRepo *game_map_repo.Repo
}
func NewServer(
@@ -33,16 +35,18 @@ func NewServer(
fileService *file_service.FileService,
scenarioService *scenarios_service.ScenarioService,
gameService *game_service.GameService,
participationService *participation_service.ParticipationService,
screenRepo *screen_sessions_repo.ScreenSessionsRepo,
mapRepo *game_map_repo.Repo,
) proto.EveningDetectiveServerServer {
return &server{
usersService: usersService,
uiService: uiService,
fileService: fileService,
scenarioService: scenarioService,
gameService: gameService,
screenRepo: screenRepo,
mapRepo: mapRepo,
usersService: usersService,
uiService: uiService,
fileService: fileService,
scenarioService: scenarioService,
gameService: gameService,
participationService: participationService,
screenRepo: screenRepo,
mapRepo: mapRepo,
}
}