This commit is contained in:
2026-09-02 23:35:15 +07:00
parent 38d2227f99
commit daba1c244d
12 changed files with 1208 additions and 276 deletions
+19
View File
@@ -848,6 +848,25 @@ func (s *server) GetGameAnswers(ctx context.Context, req *proto.GetGameAnswersRe
}, nil
}
func (s *server) GetGameResults(ctx context.Context, req *proto.GetGameResultsReq) (*proto.GetGameResultsRsp, error) {
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
if !roles.HasRole(claims, roles.Organizer) && !roles.HasRole(claims, roles.Author) {
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
}
results, err := s.gameService.GetGameResults(ctx, int(req.GameId))
if err != nil {
return &proto.GetGameResultsRsp{
Error: err.Error(),
}, nil
}
return &proto.GetGameResultsRsp{
Questions: mapResultsQuestions(results.Questions),
Teams: mapTeamResults(results.Teams),
}, nil
}
func (s *server) GetGames(ctx context.Context, req *proto.GetGamesReq) (*proto.GetGamesRsp, error) {
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
if !roles.HasRole(claims, roles.Organizer) && !roles.HasRole(claims, roles.Author) {