generated from VLADIMIR/template
add questions
This commit is contained in:
@@ -78,8 +78,9 @@ MCP-сервер (Model Context Protocol) встроен в основной б
|
|||||||
| Инструмент | Назначение |
|
| Инструмент | Назначение |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `connect` | Подключиться к игре по ссылке `/team-story/{id}?password=...`; возвращает id команды, пароль и текущую историю |
|
| `connect` | Подключиться к игре по ссылке `/team-story/{id}?password=...`; возвращает id команды, пароль и текущую историю |
|
||||||
| `get_team_story` | История команды: точки, двери, улики + инфо об игре (по паролю команды, без авторизации) |
|
| `get_team_story` | История команды: точки, двери, улики, вопросы дела + инфо об игре (по паролю команды, без авторизации) |
|
||||||
| `make_move` | Ход команды в точку по её коду; возвращает обновлённую историю (по паролю команды, без авторизации) |
|
| `make_move` | Ход команды в точку по её коду; возвращает обновлённую историю (по паролю команды, без авторизации) |
|
||||||
|
| `submit_answers` | Ответы команды на вопросы дела (массив `{question_code, answer}`); возвращает обновлённую историю (по паролю команды, без авторизации) |
|
||||||
|
|
||||||
Ссылку на игру (`/team-story/{id}?password=...`) выдаёт команде организатор личным каналом — например, вместе с паролем. Принимаются относительные и абсолютные ссылки (в т.ч. с любым хостом): HTTP-запросы по ним не выполняются, из ссылки берутся только id команды и пароль. Игроку авторизация не нужна: команда идентифицируется паролем из ссылки.
|
Ссылку на игру (`/team-story/{id}?password=...`) выдаёт команде организатор личным каналом — например, вместе с паролем. Принимаются относительные и абсолютные ссылки (в т.ч. с любым хостом): HTTP-запросы по ним не выполняются, из ссылки берутся только id команды и пароль. Игроку авторизация не нужна: команда идентифицируется паролем из ссылки.
|
||||||
|
|
||||||
|
|||||||
+187
@@ -365,6 +365,38 @@ service EveningDetectiveServer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpc AddScenarioQuestion(AddScenarioQuestionReq) returns (AddScenarioQuestionRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/api/scenarios/{id}/questions"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
tags : "Вопросы сценария";
|
||||||
|
summary: "Создать вопрос дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rpc UpdateScenarioQuestion(UpdateScenarioQuestionReq) returns (UpdateScenarioQuestionRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
put : "/api/scenarios/{id}/questions/{code}"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
tags : "Вопросы сценария";
|
||||||
|
summary: "Обновить вопрос дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rpc DeleteScenarioQuestion(DeleteScenarioQuestionReq) returns (DeleteScenarioQuestionRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
delete: "/api/scenarios/{id}/questions/{code}"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
tags : "Вопросы сценария";
|
||||||
|
summary: "Удалить вопрос дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
rpc UpdateScenarioIntro(UpdateScenarioIntroReq) returns (UpdateScenarioIntroRsp) {
|
rpc UpdateScenarioIntro(UpdateScenarioIntroReq) returns (UpdateScenarioIntroRsp) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
put : "/api/scenarios/{id}/introduction"
|
put : "/api/scenarios/{id}/introduction"
|
||||||
@@ -428,6 +460,16 @@ service EveningDetectiveServer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpc GetGameAnswers(GetGameAnswersReq) returns (GetGameAnswersRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/api/games/{gameId}/answers"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
tags : "Игры";
|
||||||
|
summary: "Получить ответы команд на вопросы дела (для оценки организатором)";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
rpc UpdateGame(UpdateGameReq) returns (UpdateGameRsp) {
|
rpc UpdateGame(UpdateGameReq) returns (UpdateGameRsp) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
put : "/api/games/{id}"
|
put : "/api/games/{id}"
|
||||||
@@ -583,6 +625,44 @@ service EveningDetectiveServer {
|
|||||||
summary: "Удалить последний ход";
|
summary: "Удалить последний ход";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpc GetTeamAnswers(GetTeamAnswersReq) returns (GetTeamAnswersRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/api/teams/{id}/answers"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
security: {
|
||||||
|
security_requirement: {}
|
||||||
|
}
|
||||||
|
tags : "Ходы";
|
||||||
|
summary: "Получить ответы команды на вопросы дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rpc SubmitTeamAnswers(SubmitTeamAnswersReq) returns (SubmitTeamAnswersRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
post: "/api/teams/{id}/answers"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
security: {
|
||||||
|
security_requirement: {}
|
||||||
|
}
|
||||||
|
tags : "Ходы";
|
||||||
|
summary: "Отправить ответы команды на вопросы дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rpc SetTeamAnswerScore(SetTeamAnswerScoreReq) returns (SetTeamAnswerScoreRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
put : "/api/teams/{id}/answers/{questionCode}/score"
|
||||||
|
body: "*"
|
||||||
|
};
|
||||||
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||||
|
tags : "Игры";
|
||||||
|
summary: "Выставить балл команде за ответ на вопрос дела";
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message PingReq {}
|
message PingReq {}
|
||||||
@@ -792,6 +872,7 @@ message Scenario {
|
|||||||
message Story {
|
message Story {
|
||||||
Introduction introduction = 2;
|
Introduction introduction = 2;
|
||||||
repeated Place places = 1;
|
repeated Place places = 1;
|
||||||
|
repeated Question questions = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Introduction {
|
message Introduction {
|
||||||
@@ -829,6 +910,43 @@ message Key {
|
|||||||
string name = 1;
|
string name = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Вопрос дела - вопрос, на который команда должна ответить в конце игры.
|
||||||
|
// Правильный ответ (answer) виден только автору сценария и организаторам
|
||||||
|
// (при оценке ответов команд), команде не передаётся.
|
||||||
|
message Question {
|
||||||
|
// Код вопроса - используется при отправке ответов командой
|
||||||
|
string code = 1;
|
||||||
|
|
||||||
|
// Текст вопроса
|
||||||
|
string text = 2;
|
||||||
|
|
||||||
|
// Правильный ответ (справка для организатора при оценке)
|
||||||
|
string answer = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ответ команды на вопрос дела
|
||||||
|
message Answer {
|
||||||
|
// Код вопроса
|
||||||
|
string questionCode = 1;
|
||||||
|
|
||||||
|
// Текст ответа команды
|
||||||
|
string answer = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ответ команды с баллом (для панели организатора)
|
||||||
|
message AnswerScore {
|
||||||
|
string questionCode = 1;
|
||||||
|
string answer = 2;
|
||||||
|
// Балл, выставленный организатором; отсутствует, если ещё не оценено
|
||||||
|
optional int32 score = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ответы одной команды на вопросы дела
|
||||||
|
message TeamAnswers {
|
||||||
|
Team team = 1;
|
||||||
|
repeated AnswerScore answers = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message UpdateScenarioReq {
|
message UpdateScenarioReq {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
@@ -901,6 +1019,34 @@ message UpdateScenarioIntroRsp {
|
|||||||
string error = 1;
|
string error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message AddScenarioQuestionReq {
|
||||||
|
int32 id = 1;
|
||||||
|
Question question = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AddScenarioQuestionRsp {
|
||||||
|
string error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateScenarioQuestionReq {
|
||||||
|
int32 id = 1;
|
||||||
|
string code = 2;
|
||||||
|
Question question = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateScenarioQuestionRsp {
|
||||||
|
string error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteScenarioQuestionReq {
|
||||||
|
int32 id = 1;
|
||||||
|
string code = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeleteScenarioQuestionRsp {
|
||||||
|
string error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message DownloadScenarioArchiveReq {
|
message DownloadScenarioArchiveReq {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
}
|
}
|
||||||
@@ -959,6 +1105,16 @@ message GetGameRsp {
|
|||||||
Game game = 2;
|
Game game = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetGameAnswersReq {
|
||||||
|
int32 gameId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetGameAnswersRsp {
|
||||||
|
string error = 1;
|
||||||
|
repeated Question questions = 2;
|
||||||
|
repeated TeamAnswers teams = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message UpdateGameReq {
|
message UpdateGameReq {
|
||||||
int32 id = 1;
|
int32 id = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
@@ -1084,3 +1240,34 @@ message DeleteLastTeamActionReq {
|
|||||||
message DeleteLastTeamActionRsp {
|
message DeleteLastTeamActionRsp {
|
||||||
string error = 1;
|
string error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetTeamAnswersReq {
|
||||||
|
int64 id = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTeamAnswersRsp {
|
||||||
|
string error = 1;
|
||||||
|
repeated Answer answers = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SubmitTeamAnswersReq {
|
||||||
|
int64 id = 1;
|
||||||
|
string password = 2;
|
||||||
|
repeated Answer answers = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SubmitTeamAnswersRsp {
|
||||||
|
string error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetTeamAnswerScoreReq {
|
||||||
|
int64 id = 1;
|
||||||
|
string questionCode = 2;
|
||||||
|
// Балл; отсутствует — сбросить выставленный балл
|
||||||
|
optional int32 score = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SetTeamAnswerScoreRsp {
|
||||||
|
string error = 1;
|
||||||
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -18,6 +18,7 @@ import (
|
|||||||
"evening_detective_server/internal/repos/games_repo"
|
"evening_detective_server/internal/repos/games_repo"
|
||||||
"evening_detective_server/internal/repos/refresh_tokens_repo"
|
"evening_detective_server/internal/repos/refresh_tokens_repo"
|
||||||
"evening_detective_server/internal/repos/scenarios_repo"
|
"evening_detective_server/internal/repos/scenarios_repo"
|
||||||
|
"evening_detective_server/internal/repos/team_answers_repo"
|
||||||
"evening_detective_server/internal/repos/teams_repo"
|
"evening_detective_server/internal/repos/teams_repo"
|
||||||
"evening_detective_server/internal/repos/users_repo"
|
"evening_detective_server/internal/repos/users_repo"
|
||||||
"evening_detective_server/internal/services/file_service"
|
"evening_detective_server/internal/services/file_service"
|
||||||
@@ -125,6 +126,7 @@ func main() {
|
|||||||
storyteller := storytelling.NewStory(cleaner)
|
storyteller := storytelling.NewStory(cleaner)
|
||||||
actionsRepo := actions_repo.NewActionsRepo(dbpool)
|
actionsRepo := actions_repo.NewActionsRepo(dbpool)
|
||||||
applicationsRepo := applications_repo.NewApplicationsRepo(dbpool)
|
applicationsRepo := applications_repo.NewApplicationsRepo(dbpool)
|
||||||
|
answersRepo := team_answers_repo.NewTeamAnswersRepo(dbpool)
|
||||||
gameService := game_service.NewGameService(
|
gameService := game_service.NewGameService(
|
||||||
gameRepo,
|
gameRepo,
|
||||||
teamRepo,
|
teamRepo,
|
||||||
@@ -135,6 +137,7 @@ func main() {
|
|||||||
storyteller,
|
storyteller,
|
||||||
actionsRepo,
|
actionsRepo,
|
||||||
applicationsRepo,
|
applicationsRepo,
|
||||||
|
answersRepo,
|
||||||
cleaner,
|
cleaner,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -161,6 +164,8 @@ func main() {
|
|||||||
"/crabs.evening_detective_server.EveningDetectiveServer/GetScenariosCatalog": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetScenariosCatalog": true,
|
||||||
"/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory": true,
|
||||||
"/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction": true,
|
||||||
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetTeamAnswers": true,
|
||||||
|
"/crabs.evening_detective_server.EveningDetectiveServer/SubmitTeamAnswers": true,
|
||||||
"/crabs.evening_detective_server.EveningDetectiveServer/GetTerms": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetTerms": true,
|
||||||
"/crabs.evening_detective_server.EveningDetectiveServer/GetPrivacy": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetPrivacy": true,
|
||||||
"/crabs.evening_detective_server.EveningDetectiveServer/GetConsent": true,
|
"/crabs.evening_detective_server.EveningDetectiveServer/GetConsent": true,
|
||||||
|
|||||||
@@ -356,6 +356,38 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/games/{gameId}/answers": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Получить ответы команд на вопросы дела (для оценки организатором)",
|
||||||
|
"operationId": "EveningDetectiveServer_GetGameAnswers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverGetGameAnswersRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "gameId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Игры"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/games/{id}": {
|
"/api/games/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Получить игру",
|
"summary": "Получить игру",
|
||||||
@@ -1175,6 +1207,128 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/scenarios/{id}/questions": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Создать вопрос дела",
|
||||||
|
"operationId": "EveningDetectiveServer_AddScenarioQuestion",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverAddScenarioQuestionRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/EveningDetectiveServerAddScenarioQuestionBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Вопросы сценария"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/scenarios/{id}/questions/{code}": {
|
||||||
|
"delete": {
|
||||||
|
"summary": "Удалить вопрос дела",
|
||||||
|
"operationId": "EveningDetectiveServer_DeleteScenarioQuestion",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverDeleteScenarioQuestionRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "code",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Вопросы сценария"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"summary": "Обновить вопрос дела",
|
||||||
|
"operationId": "EveningDetectiveServer_UpdateScenarioQuestion",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverUpdateScenarioQuestionRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "code",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/EveningDetectiveServerUpdateScenarioQuestionBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Вопросы сценария"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/teams": {
|
"/api/teams": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Создать команду",
|
"summary": "Создать команду",
|
||||||
@@ -1323,6 +1477,138 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/teams/{id}/answers": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Получить ответы команды на вопросы дела",
|
||||||
|
"operationId": "EveningDetectiveServer_GetTeamAnswers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverGetTeamAnswersRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "password",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Ходы"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"summary": "Отправить ответы команды на вопросы дела",
|
||||||
|
"operationId": "EveningDetectiveServer_SubmitTeamAnswers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverSubmitTeamAnswersRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/EveningDetectiveServerSubmitTeamAnswersBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Ходы"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/teams/{id}/answers/{questionCode}/score": {
|
||||||
|
"put": {
|
||||||
|
"summary": "Выставить балл команде за ответ на вопрос дела",
|
||||||
|
"operationId": "EveningDetectiveServer_SetTeamAnswerScore",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverSetTeamAnswerScoreRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/rpcStatus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "questionCode",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/EveningDetectiveServerSetTeamAnswerScoreBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Игры"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/teams/{id}/applications": {
|
"/api/teams/{id}/applications": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Выдать улику",
|
"summary": "Выдать улику",
|
||||||
@@ -1716,6 +2002,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"EveningDetectiveServerAddScenarioQuestionBody": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"question": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverQuestion"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"EveningDetectiveServerAddTeamActionBody": {
|
"EveningDetectiveServerAddTeamActionBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1769,9 +2063,34 @@
|
|||||||
"EveningDetectiveServerResetGameBody": {
|
"EveningDetectiveServerResetGameBody": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"EveningDetectiveServerSetTeamAnswerScoreBody": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"score": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"title": "Балл; отсутствует — сбросить выставленный балл"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"EveningDetectiveServerStartGameBody": {
|
"EveningDetectiveServerStartGameBody": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"EveningDetectiveServerSubmitTeamAnswersBody": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"answers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverAnswer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"EveningDetectiveServerUpdateGameBody": {
|
"EveningDetectiveServerUpdateGameBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1821,6 +2140,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"EveningDetectiveServerUpdateScenarioQuestionBody": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"question": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverQuestion"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"EveningDetectiveServerUpdateTeamBody": {
|
"EveningDetectiveServerUpdateTeamBody": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1891,6 +2218,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverAddScenarioQuestionRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverAddScenarioReq": {
|
"evening_detective_serverAddScenarioReq": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1954,6 +2289,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverAnswer": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"questionCode": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Код вопроса"
|
||||||
|
},
|
||||||
|
"answer": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Текст ответа команды"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"title": "Ответ команды на вопрос дела"
|
||||||
|
},
|
||||||
|
"evening_detective_serverAnswerScore": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"questionCode": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"answer": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"score": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"title": "Балл, выставленный организатором; отсутствует, если ещё не оценено"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"title": "Ответ команды с баллом (для панели организатора)"
|
||||||
|
},
|
||||||
"evening_detective_serverApplication": {
|
"evening_detective_serverApplication": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -1965,7 +2331,7 @@
|
|||||||
},
|
},
|
||||||
"file_type": {
|
"file_type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Тип файла улики: image | pdf | audio. Значение выводится сервером из\nрасширения файла (см. file_storage.FileType); пустое значение возможно\nтолько для legacy-строк без расширения. Явный json_name — осознанное\nотклонение от camelCase-конвенции REST (единый snake_case с внутренним\nJSON истории)."
|
"description": "Тип файла улики: image | pdf | audio. Значение выводится сервером из\nрасширения файла (см. file_storage.FileType); пустое значение возможно\nтолько для legacy-строк без расширения."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2001,6 +2367,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverDeleteScenarioQuestionRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverDeleteScenarioRsp": {
|
"evening_detective_serverDeleteScenarioRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2118,6 +2492,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverGetGameAnswersRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"questions": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverQuestion"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"teams": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverTeamAnswers"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverGetGameRsp": {
|
"evening_detective_serverGetGameRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2221,6 +2617,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverGetTeamAnswersRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"answers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverAnswer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverGetTeamStoryRsp": {
|
"evening_detective_serverGetTeamStoryRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2392,6 +2803,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverQuestion": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Код вопроса - используется при отправке ответов командой"
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Текст вопроса"
|
||||||
|
},
|
||||||
|
"answer": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Правильный ответ (справка для организатора при оценке)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Вопрос дела - вопрос, на который команда должна ответить в конце игры.\nПравильный ответ (answer) виден только автору сценария и организаторам\n(при оценке ответов команд), команде не передаётся."
|
||||||
|
},
|
||||||
"evening_detective_serverRefreshPasswordReq": {
|
"evening_detective_serverRefreshPasswordReq": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2477,6 +2906,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverSetTeamAnswerScoreRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverSignupReq": {
|
"evening_detective_serverSignupReq": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2522,6 +2959,21 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"$ref": "#/definitions/evening_detective_serverPlace"
|
"$ref": "#/definitions/evening_detective_serverPlace"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"questions": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverQuestion"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"evening_detective_serverSubmitTeamAnswersRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2554,6 +3006,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverTeamAnswers": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"team": {
|
||||||
|
"$ref": "#/definitions/evening_detective_serverTeam"
|
||||||
|
},
|
||||||
|
"answers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/evening_detective_serverAnswerScore"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"title": "Ответы одной команды на вопросы дела"
|
||||||
|
},
|
||||||
"evening_detective_serverUpdateGameRsp": {
|
"evening_detective_serverUpdateGameRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2578,6 +3046,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"evening_detective_serverUpdateScenarioQuestionRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"evening_detective_serverUpdateScenarioRsp": {
|
"evening_detective_serverUpdateScenarioRsp": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"evening_detective_server/internal/services/game_service"
|
||||||
|
proto "evening_detective_server/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
func mapAnswers(o []game_service.Answer) []*proto.Answer {
|
||||||
|
res := make([]*proto.Answer, 0, len(o))
|
||||||
|
for _, item := range o {
|
||||||
|
res = append(res, &proto.Answer{
|
||||||
|
QuestionCode: item.QuestionCode,
|
||||||
|
Answer: item.Text,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertAnswers(o []*proto.Answer) []game_service.Answer {
|
||||||
|
res := make([]game_service.Answer, 0, len(o))
|
||||||
|
for _, item := range o {
|
||||||
|
res = append(res, game_service.Answer{
|
||||||
|
QuestionCode: item.QuestionCode,
|
||||||
|
Text: item.Answer,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func mapAnswerScores(o []game_service.AnswerScore) []*proto.AnswerScore {
|
||||||
|
res := make([]*proto.AnswerScore, 0, len(o))
|
||||||
|
for _, item := range o {
|
||||||
|
score := &proto.AnswerScore{
|
||||||
|
QuestionCode: item.QuestionCode,
|
||||||
|
Answer: item.Text,
|
||||||
|
}
|
||||||
|
if item.Score != nil {
|
||||||
|
v := int32(*item.Score)
|
||||||
|
score.Score = &v
|
||||||
|
}
|
||||||
|
res = append(res, score)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func mapTeamAnswers(o []game_service.TeamAnswers) []*proto.TeamAnswers {
|
||||||
|
res := make([]*proto.TeamAnswers, 0, len(o))
|
||||||
|
for _, item := range o {
|
||||||
|
res = append(res, &proto.TeamAnswers{
|
||||||
|
Team: mapTeam(item.Team),
|
||||||
|
Answers: mapAnswerScores(item.Answers),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -599,6 +599,73 @@ func (s *server) DeleteScenarioPlace(ctx context.Context, req *proto.DeleteScena
|
|||||||
return &proto.DeleteScenarioPlaceRsp{}, nil
|
return &proto.DeleteScenarioPlaceRsp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) AddScenarioQuestion(ctx context.Context, req *proto.AddScenarioQuestionReq) (*proto.AddScenarioQuestionRsp, error) {
|
||||||
|
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||||
|
if !roles.HasRole(claims, roles.Author) {
|
||||||
|
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := s.scenarioService.AddScenarioQuestion(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
convertQuestion(req.Question),
|
||||||
|
claims.UserID,
|
||||||
|
roles.HasRole(claims, roles.Admin),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.AddScenarioQuestionRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.AddScenarioQuestionRsp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *server) UpdateScenarioQuestion(ctx context.Context, req *proto.UpdateScenarioQuestionReq) (*proto.UpdateScenarioQuestionRsp, error) {
|
||||||
|
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||||
|
if !roles.HasRole(claims, roles.Author) {
|
||||||
|
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := s.scenarioService.UpdateScenarioQuestion(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
req.Code,
|
||||||
|
convertQuestion(req.Question),
|
||||||
|
claims.UserID,
|
||||||
|
roles.HasRole(claims, roles.Admin),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.UpdateScenarioQuestionRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.UpdateScenarioQuestionRsp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *server) DeleteScenarioQuestion(ctx context.Context, req *proto.DeleteScenarioQuestionReq) (*proto.DeleteScenarioQuestionRsp, error) {
|
||||||
|
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||||
|
if !roles.HasRole(claims, roles.Author) {
|
||||||
|
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||||
|
}
|
||||||
|
|
||||||
|
err := s.scenarioService.DeleteScenarioQuestion(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
req.Code,
|
||||||
|
claims.UserID,
|
||||||
|
roles.HasRole(claims, roles.Admin),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.DeleteScenarioQuestionRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.DeleteScenarioQuestionRsp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *server) UpdateScenarioIntro(ctx context.Context, req *proto.UpdateScenarioIntroReq) (*proto.UpdateScenarioIntroRsp, error) {
|
func (s *server) UpdateScenarioIntro(ctx context.Context, req *proto.UpdateScenarioIntroReq) (*proto.UpdateScenarioIntroRsp, error) {
|
||||||
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||||
if !roles.HasRole(claims, roles.Author) {
|
if !roles.HasRole(claims, roles.Author) {
|
||||||
@@ -762,6 +829,25 @@ func (s *server) GetGame(ctx context.Context, req *proto.GetGameReq) (*proto.Get
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) GetGameAnswers(ctx context.Context, req *proto.GetGameAnswersReq) (*proto.GetGameAnswersRsp, 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")
|
||||||
|
}
|
||||||
|
|
||||||
|
gameAnswers, err := s.gameService.GetGameAnswers(ctx, int(req.GameId))
|
||||||
|
if err != nil {
|
||||||
|
return &proto.GetGameAnswersRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.GetGameAnswersRsp{
|
||||||
|
Questions: mapQuestions(gameAnswers.Questions),
|
||||||
|
Teams: mapTeamAnswers(gameAnswers.Teams),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *server) GetGames(ctx context.Context, req *proto.GetGamesReq) (*proto.GetGamesRsp, error) {
|
func (s *server) GetGames(ctx context.Context, req *proto.GetGamesReq) (*proto.GetGamesRsp, error) {
|
||||||
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
|
||||||
if !roles.HasRole(claims, roles.Organizer) && !roles.HasRole(claims, roles.Author) {
|
if !roles.HasRole(claims, roles.Organizer) && !roles.HasRole(claims, roles.Author) {
|
||||||
@@ -1022,3 +1108,63 @@ func (s *server) DeleteLastTeamAction(ctx context.Context, req *proto.DeleteLast
|
|||||||
|
|
||||||
return &proto.DeleteLastTeamActionRsp{}, nil
|
return &proto.DeleteLastTeamActionRsp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) GetTeamAnswers(ctx context.Context, req *proto.GetTeamAnswersReq) (*proto.GetTeamAnswersRsp, error) {
|
||||||
|
answers, err := s.gameService.GetTeamAnswers(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
req.Password,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.GetTeamAnswersRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.GetTeamAnswersRsp{
|
||||||
|
Answers: mapAnswers(answers),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *server) SubmitTeamAnswers(ctx context.Context, req *proto.SubmitTeamAnswersReq) (*proto.SubmitTeamAnswersRsp, error) {
|
||||||
|
err := s.gameService.SubmitTeamAnswers(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
req.Password,
|
||||||
|
convertAnswers(req.Answers),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.SubmitTeamAnswersRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.SubmitTeamAnswersRsp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *server) SetTeamAnswerScore(ctx context.Context, req *proto.SetTeamAnswerScoreReq) (*proto.SetTeamAnswerScoreRsp, 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")
|
||||||
|
}
|
||||||
|
|
||||||
|
var score *int
|
||||||
|
if req.Score != nil {
|
||||||
|
v := int(req.GetScore())
|
||||||
|
score = &v
|
||||||
|
}
|
||||||
|
|
||||||
|
err := s.gameService.SetTeamAnswerScore(
|
||||||
|
ctx,
|
||||||
|
int(req.Id),
|
||||||
|
req.QuestionCode,
|
||||||
|
score,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return &proto.SetTeamAnswerScoreRsp{
|
||||||
|
Error: err.Error(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &proto.SetTeamAnswerScoreRsp{}, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ func mapStory(o *storytelling.Story) *proto.Story {
|
|||||||
return &proto.Story{
|
return &proto.Story{
|
||||||
Introduction: mapIntroduction(o.Introduction),
|
Introduction: mapIntroduction(o.Introduction),
|
||||||
Places: mapPlaces(o.Places),
|
Places: mapPlaces(o.Places),
|
||||||
|
Questions: mapQuestions(o.Questions),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,3 +198,33 @@ func convertIntroduction(o *proto.Introduction) *storytelling.Introduction {
|
|||||||
Audio: o.Audio,
|
Audio: o.Audio,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mapQuestions(o []*storytelling.Question) []*proto.Question {
|
||||||
|
res := make([]*proto.Question, 0, len(o))
|
||||||
|
for _, item := range o {
|
||||||
|
res = append(res, mapQuestion(item))
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func mapQuestion(o *storytelling.Question) *proto.Question {
|
||||||
|
if o == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &proto.Question{
|
||||||
|
Code: o.Code,
|
||||||
|
Text: o.Text,
|
||||||
|
Answer: o.Answer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertQuestion(o *proto.Question) *storytelling.Question {
|
||||||
|
if o == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &storytelling.Question{
|
||||||
|
Code: o.Code,
|
||||||
|
Text: textFormatter.FormatText(o.Text),
|
||||||
|
Answer: textFormatter.FormatText(o.Answer),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type IStory interface {
|
|||||||
GetStory(scenario *Story, codes []string) *Story
|
GetStory(scenario *Story, codes []string) *Story
|
||||||
}
|
}
|
||||||
|
|
||||||
// История - это введение и набор точек
|
// История - это введение, набор точек и вопросы дела
|
||||||
type Story struct {
|
type Story struct {
|
||||||
|
|
||||||
// Введение - то, что игрок получает в начале игры
|
// Введение - то, что игрок получает в начале игры
|
||||||
@@ -12,6 +12,24 @@ type Story struct {
|
|||||||
|
|
||||||
// Список точек
|
// Список точек
|
||||||
Places []*Place `json:"places"`
|
Places []*Place `json:"places"`
|
||||||
|
|
||||||
|
// Вопросы дела - список вопросов, на которые команда должна ответить
|
||||||
|
Questions []*Question `json:"questions,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Вопрос дела - вопрос, который автор сценария добавляет вместе с
|
||||||
|
// правильным ответом; команда отвечает на вопросы в конце игры
|
||||||
|
type Question struct {
|
||||||
|
|
||||||
|
// Код - идентификатор вопроса, используется при отправке ответов
|
||||||
|
Code string `json:"code"`
|
||||||
|
|
||||||
|
// Текст вопроса
|
||||||
|
Text string `json:"text"`
|
||||||
|
|
||||||
|
// Правильный ответ - виден только автору и организаторам,
|
||||||
|
// команде не передаётся
|
||||||
|
Answer string `json:"answer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Введение - текст и аудио, которые игрок получает в начале игры
|
// Введение - текст и аудио, которые игрок получает в начале игры
|
||||||
|
|||||||
@@ -29,6 +29,15 @@ func (s *story) GetStory(
|
|||||||
Audio: scenario.Introduction.Audio,
|
Audio: scenario.Introduction.Audio,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Вопросы дела передаются команде всегда — с начала игры; правильные
|
||||||
|
// ответы (Answer) команде не передаются: они нужны только автору и
|
||||||
|
// организаторам при оценке ответов.
|
||||||
|
for _, question := range scenario.Questions {
|
||||||
|
story.Questions = append(story.Questions, &Question{
|
||||||
|
Code: question.Code,
|
||||||
|
Text: s.cleaner.ClearText(question.Text),
|
||||||
|
})
|
||||||
|
}
|
||||||
for i, code := range codes {
|
for i, code := range codes {
|
||||||
var prevPlace *Place
|
var prevPlace *Place
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
|
|||||||
@@ -807,3 +807,113 @@ func Test_story_GetStory(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_story_GetStoryQuestions(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
scenario *Story
|
||||||
|
codes []string
|
||||||
|
want *Story
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Вопросы передаются команде с начала игры (без действий)",
|
||||||
|
scenario: &Story{
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Кто убийца?",
|
||||||
|
Answer: "Дворецкий",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codes: []string{},
|
||||||
|
want: &Story{
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Кто убийца?",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Правильные ответы не передаются команде",
|
||||||
|
scenario: &Story{
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Вопрос 1.([секрет])",
|
||||||
|
Answer: "Ответ 1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Code: "q2",
|
||||||
|
Text: "Вопрос 2",
|
||||||
|
Answer: "Ответ 2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codes: []string{},
|
||||||
|
want: &Story{
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Вопрос 1.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Code: "q2",
|
||||||
|
Text: "Вопрос 2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Вопросы передаются вместе с точками и введением",
|
||||||
|
scenario: &Story{
|
||||||
|
Introduction: &Introduction{
|
||||||
|
Text: "Введение.",
|
||||||
|
Audio: "intro.mp3",
|
||||||
|
},
|
||||||
|
Places: []*Place{
|
||||||
|
{
|
||||||
|
Code: "Ы",
|
||||||
|
Name: "Название точки",
|
||||||
|
Text: "Текст точки.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Вопрос 1",
|
||||||
|
Answer: "Ответ 1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codes: []string{"Ы"},
|
||||||
|
want: &Story{
|
||||||
|
Introduction: &Introduction{
|
||||||
|
Text: "Введение.",
|
||||||
|
Audio: "intro.mp3",
|
||||||
|
},
|
||||||
|
Places: []*Place{
|
||||||
|
{
|
||||||
|
Code: "Ы",
|
||||||
|
Name: "Название точки",
|
||||||
|
Text: "Текст точки.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Questions: []*Question{
|
||||||
|
{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Вопрос 1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
got := NewStory(cleaner.NewCleaner()).GetStory(tt.scenario, tt.codes)
|
||||||
|
assert.Equal(t, got, tt.want)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package repos
|
||||||
|
|
||||||
|
// TeamAnswer — ответ команды на вопрос дела (вопросы живут в сценарии,
|
||||||
|
// ответы — в таблице team_answers).
|
||||||
|
type TeamAnswer struct {
|
||||||
|
TeamId int
|
||||||
|
QuestionCode string
|
||||||
|
Text string
|
||||||
|
// Score — балл, выставленный организатором; nil — ещё не оценено.
|
||||||
|
Score *int
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package team_answers_repo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"evening_detective_server/internal/repos"
|
||||||
|
|
||||||
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrAnswerNotFound = errors.New("Ответ не найден")
|
||||||
|
)
|
||||||
|
|
||||||
|
type TeamAnswersRepo struct {
|
||||||
|
pool *pgxpool.Pool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTeamAnswersRepo(pool *pgxpool.Pool) *TeamAnswersRepo {
|
||||||
|
return &TeamAnswersRepo{
|
||||||
|
pool: pool,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpsertAnswers сохраняет ответы команды: существующие перезаписываются,
|
||||||
|
// отсутствующие — вставляются (UNIQUE (team_id, question_code)).
|
||||||
|
func (r *TeamAnswersRepo) UpsertAnswers(
|
||||||
|
ctx context.Context,
|
||||||
|
teamId int,
|
||||||
|
answers []repos.TeamAnswer,
|
||||||
|
) error {
|
||||||
|
for _, answer := range answers {
|
||||||
|
_, err := r.pool.Exec(
|
||||||
|
ctx,
|
||||||
|
`INSERT INTO team_answers (team_id, question_code, answer)
|
||||||
|
VALUES ($1, $2, $3)
|
||||||
|
ON CONFLICT (team_id, question_code)
|
||||||
|
DO UPDATE SET
|
||||||
|
answer = EXCLUDED.answer,
|
||||||
|
updated_at = NOW()`,
|
||||||
|
teamId,
|
||||||
|
answer.QuestionCode,
|
||||||
|
answer.Text,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *TeamAnswersRepo) GetAnswersByTeamID(
|
||||||
|
ctx context.Context,
|
||||||
|
teamId int,
|
||||||
|
) ([]*repos.TeamAnswer, error) {
|
||||||
|
rows, err := r.pool.Query(
|
||||||
|
ctx,
|
||||||
|
`SELECT
|
||||||
|
team_id,
|
||||||
|
question_code,
|
||||||
|
answer,
|
||||||
|
score
|
||||||
|
FROM team_answers
|
||||||
|
WHERE team_id = $1
|
||||||
|
ORDER BY question_code ASC`,
|
||||||
|
teamId,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
var answers []*repos.TeamAnswer
|
||||||
|
for rows.Next() {
|
||||||
|
answer := &repos.TeamAnswer{}
|
||||||
|
err := rows.Scan(
|
||||||
|
&answer.TeamId,
|
||||||
|
&answer.QuestionCode,
|
||||||
|
&answer.Text,
|
||||||
|
&answer.Score,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
answers = append(answers, answer)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return answers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAnswersByGameID возвращает ответы всех команд игры (вместе с баллами).
|
||||||
|
func (r *TeamAnswersRepo) GetAnswersByGameID(
|
||||||
|
ctx context.Context,
|
||||||
|
gameId int,
|
||||||
|
) ([]*repos.TeamAnswer, error) {
|
||||||
|
rows, err := r.pool.Query(
|
||||||
|
ctx,
|
||||||
|
`SELECT
|
||||||
|
teams.id,
|
||||||
|
team_answers.question_code,
|
||||||
|
team_answers.answer,
|
||||||
|
team_answers.score
|
||||||
|
FROM team_answers
|
||||||
|
JOIN teams ON teams.id = team_answers.team_id
|
||||||
|
WHERE teams.game_id = $1
|
||||||
|
ORDER BY teams.id ASC, team_answers.question_code ASC`,
|
||||||
|
gameId,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
var answers []*repos.TeamAnswer
|
||||||
|
for rows.Next() {
|
||||||
|
answer := &repos.TeamAnswer{}
|
||||||
|
err := rows.Scan(
|
||||||
|
&answer.TeamId,
|
||||||
|
&answer.QuestionCode,
|
||||||
|
&answer.Text,
|
||||||
|
&answer.Score,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
answers = append(answers, answer)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return answers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAnswerScore выставляет балл за ответ; score == nil сбрасывает балл.
|
||||||
|
func (r *TeamAnswersRepo) SetAnswerScore(
|
||||||
|
ctx context.Context,
|
||||||
|
teamId int,
|
||||||
|
questionCode string,
|
||||||
|
score *int,
|
||||||
|
) error {
|
||||||
|
tag, err := r.pool.Exec(
|
||||||
|
ctx,
|
||||||
|
`UPDATE team_answers
|
||||||
|
SET
|
||||||
|
score = $1,
|
||||||
|
updated_at = NOW()
|
||||||
|
WHERE team_id = $2 AND question_code = $3`,
|
||||||
|
score,
|
||||||
|
teamId,
|
||||||
|
questionCode,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if tag.RowsAffected() == 0 {
|
||||||
|
return ErrAnswerNotFound
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package game_service
|
||||||
|
|
||||||
|
import "evening_detective_server/internal/modules/storytelling"
|
||||||
|
|
||||||
|
// Answer — ответ команды на вопрос дела (для публичного API команды).
|
||||||
|
type Answer struct {
|
||||||
|
QuestionCode string
|
||||||
|
Text string
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnswerScore — ответ команды с баллом организатора (для панели оценки).
|
||||||
|
type AnswerScore struct {
|
||||||
|
QuestionCode string
|
||||||
|
Text string
|
||||||
|
// Score — балл; nil — ещё не оценено.
|
||||||
|
Score *int
|
||||||
|
}
|
||||||
|
|
||||||
|
// TeamAnswers — ответы одной команды игры.
|
||||||
|
type TeamAnswers struct {
|
||||||
|
Team *Team
|
||||||
|
Answers []AnswerScore
|
||||||
|
}
|
||||||
|
|
||||||
|
// GameAnswers — полная картина для оценки организатором: вопросы сценария
|
||||||
|
// (с правильными ответами) и ответы всех команд с баллами.
|
||||||
|
type GameAnswers struct {
|
||||||
|
Questions []*storytelling.Question
|
||||||
|
Teams []TeamAnswers
|
||||||
|
}
|
||||||
@@ -2,13 +2,16 @@ package game_service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"evening_detective_server/internal/modules/cleaner"
|
"evening_detective_server/internal/modules/cleaner"
|
||||||
"evening_detective_server/internal/modules/password_generator"
|
"evening_detective_server/internal/modules/password_generator"
|
||||||
"evening_detective_server/internal/modules/storytelling"
|
"evening_detective_server/internal/modules/storytelling"
|
||||||
|
"evening_detective_server/internal/repos"
|
||||||
"evening_detective_server/internal/repos/actions_repo"
|
"evening_detective_server/internal/repos/actions_repo"
|
||||||
"evening_detective_server/internal/repos/applications_repo"
|
"evening_detective_server/internal/repos/applications_repo"
|
||||||
"evening_detective_server/internal/repos/games_repo"
|
"evening_detective_server/internal/repos/games_repo"
|
||||||
"evening_detective_server/internal/repos/scenarios_repo"
|
"evening_detective_server/internal/repos/scenarios_repo"
|
||||||
|
"evening_detective_server/internal/repos/team_answers_repo"
|
||||||
"evening_detective_server/internal/repos/teams_repo"
|
"evening_detective_server/internal/repos/teams_repo"
|
||||||
"evening_detective_server/internal/services/scenarios_service"
|
"evening_detective_server/internal/services/scenarios_service"
|
||||||
"time"
|
"time"
|
||||||
@@ -24,6 +27,7 @@ type GameService struct {
|
|||||||
storyteller storytelling.IStory
|
storyteller storytelling.IStory
|
||||||
actionsRepo *actions_repo.ActionsRepo
|
actionsRepo *actions_repo.ActionsRepo
|
||||||
applicationsRepo *applications_repo.ApplicationsRepo
|
applicationsRepo *applications_repo.ApplicationsRepo
|
||||||
|
answersRepo *team_answers_repo.TeamAnswersRepo
|
||||||
cleaner cleaner.ICleaner
|
cleaner cleaner.ICleaner
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +41,7 @@ func NewGameService(
|
|||||||
storyteller storytelling.IStory,
|
storyteller storytelling.IStory,
|
||||||
actionsRepo *actions_repo.ActionsRepo,
|
actionsRepo *actions_repo.ActionsRepo,
|
||||||
applicationsRepo *applications_repo.ApplicationsRepo,
|
applicationsRepo *applications_repo.ApplicationsRepo,
|
||||||
|
answersRepo *team_answers_repo.TeamAnswersRepo,
|
||||||
cleaner cleaner.ICleaner,
|
cleaner cleaner.ICleaner,
|
||||||
) *GameService {
|
) *GameService {
|
||||||
return &GameService{
|
return &GameService{
|
||||||
@@ -49,6 +54,7 @@ func NewGameService(
|
|||||||
storyteller: storyteller,
|
storyteller: storyteller,
|
||||||
actionsRepo: actionsRepo,
|
actionsRepo: actionsRepo,
|
||||||
applicationsRepo: applicationsRepo,
|
applicationsRepo: applicationsRepo,
|
||||||
|
answersRepo: answersRepo,
|
||||||
cleaner: cleaner,
|
cleaner: cleaner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,3 +312,175 @@ func (s *GameService) DeleteLastTeamAction(ctx context.Context, teamId int) erro
|
|||||||
|
|
||||||
return s.actionsRepo.DeleteLastActionByTeamId(ctx, teamId)
|
return s.actionsRepo.DeleteLastActionByTeamId(ctx, teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ErrGameFinished — после завершения игры ответы команд больше нельзя
|
||||||
|
// изменять: организатор оценивает их в панели игры.
|
||||||
|
ErrGameFinished = errors.New("Игра завершена, ответы больше нельзя изменять")
|
||||||
|
// ErrGameNotStarted — игра ещё не начата, отвечать на вопросы нельзя.
|
||||||
|
ErrGameNotStarted = errors.New("Игра не начата, отвечать на вопросы нельзя")
|
||||||
|
// ErrQuestionNotFound — вопрос с таким кодом отсутствует в сценарии игры.
|
||||||
|
ErrQuestionNotFound = errors.New("Вопрос не найден")
|
||||||
|
)
|
||||||
|
|
||||||
|
// getTeamAndGame проверяет команду по паролю и возвращает её вместе с игрой.
|
||||||
|
func (s *GameService) getTeamAndGame(ctx context.Context, teamId int, password string) (*repos.Team, *repos.Game, error) {
|
||||||
|
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
if team.Password != password {
|
||||||
|
return nil, nil, teams_repo.ErrTeamNotFound
|
||||||
|
}
|
||||||
|
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
return team, game, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// getScenarioQuestionsByCode возвращает вопросы сценария игры с индексацией по коду.
|
||||||
|
func (s *GameService) getScenarioQuestionsByCode(ctx context.Context, scenarioId int) ([]*storytelling.Question, map[string]*storytelling.Question, error) {
|
||||||
|
scenario, err := s.scenarioService.GetFullScenarioByID(ctx, scenarioId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
byCode := make(map[string]*storytelling.Question, len(scenario.Story.Questions))
|
||||||
|
for _, question := range scenario.Story.Questions {
|
||||||
|
byCode[question.Code] = question
|
||||||
|
}
|
||||||
|
return scenario.Story.Questions, byCode, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTeamAnswers возвращает ответы команды на вопросы дела (без баллов:
|
||||||
|
// баллы видны только организаторам). Ответы на удалённые из сценария
|
||||||
|
// вопросы не возвращаются.
|
||||||
|
func (s *GameService) GetTeamAnswers(ctx context.Context, teamId int, password string) ([]Answer, error) {
|
||||||
|
_, game, err := s.getTeamAndGame(ctx, teamId, password)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, byCode, err := s.getScenarioQuestionsByCode(ctx, game.ScenarioId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
teamAnswers, err := s.answersRepo.GetAnswersByTeamID(ctx, teamId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
answers := make([]Answer, 0, len(teamAnswers))
|
||||||
|
for _, teamAnswer := range teamAnswers {
|
||||||
|
if _, ok := byCode[teamAnswer.QuestionCode]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
answers = append(answers, Answer{
|
||||||
|
QuestionCode: teamAnswer.QuestionCode,
|
||||||
|
Text: teamAnswer.Text,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return answers, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SubmitTeamAnswers сохраняет ответы команды на вопросы дела (upsert).
|
||||||
|
// Доступно только пока игра идёт (статусы run/pause): после завершения
|
||||||
|
// ответы фиксируются для оценки организатором. Переданные коды должны
|
||||||
|
// существовать в сценарии игры; пустая строка очищает ответ.
|
||||||
|
func (s *GameService) SubmitTeamAnswers(ctx context.Context, teamId int, password string, answers []Answer) error {
|
||||||
|
_, game, err := s.getTeamAndGame(ctx, teamId, password)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
switch game.Status {
|
||||||
|
case "run", "pause":
|
||||||
|
// игра идёт — можно отвечать
|
||||||
|
default:
|
||||||
|
if game.Status == "finish" {
|
||||||
|
return ErrGameFinished
|
||||||
|
}
|
||||||
|
return ErrGameNotStarted
|
||||||
|
}
|
||||||
|
_, byCode, err := s.getScenarioQuestionsByCode(ctx, game.ScenarioId)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := make([]repos.TeamAnswer, 0, len(answers))
|
||||||
|
for _, answer := range answers {
|
||||||
|
if _, ok := byCode[answer.QuestionCode]; !ok {
|
||||||
|
return ErrQuestionNotFound
|
||||||
|
}
|
||||||
|
rows = append(rows, repos.TeamAnswer{
|
||||||
|
QuestionCode: answer.QuestionCode,
|
||||||
|
Text: answer.Text,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return s.answersRepo.UpsertAnswers(ctx, teamId, rows)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGameAnswers возвращает полную картину для оценки организатором:
|
||||||
|
// вопросы сценария с правильными ответами и ответы всех команд с баллами.
|
||||||
|
// Ответы на удалённые из сценария вопросы не возвращаются (как в
|
||||||
|
// GetTeamAnswers).
|
||||||
|
func (s *GameService) GetGameAnswers(ctx context.Context, gameId int) (*GameAnswers, error) {
|
||||||
|
game, err := s.gamesRepo.GetGameByID(ctx, gameId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
questions, byCode, err := s.getScenarioQuestionsByCode(ctx, game.ScenarioId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
teams, err := s.teamsRepo.GetTeamsByGameID(ctx, gameId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
rows, err := s.answersRepo.GetAnswersByGameID(ctx, gameId)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
answersByTeam := make(map[int][]AnswerScore, len(teams))
|
||||||
|
for _, row := range rows {
|
||||||
|
if _, ok := byCode[row.QuestionCode]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
score := row.Score
|
||||||
|
answersByTeam[row.TeamId] = append(answersByTeam[row.TeamId], AnswerScore{
|
||||||
|
QuestionCode: row.QuestionCode,
|
||||||
|
Text: row.Text,
|
||||||
|
Score: score,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
teamAnswers := make([]TeamAnswers, 0, len(teams))
|
||||||
|
for _, team := range teams {
|
||||||
|
teamAnswers = append(teamAnswers, TeamAnswers{
|
||||||
|
Team: mapTeam(team),
|
||||||
|
Answers: answersByTeam[team.ID],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &GameAnswers{
|
||||||
|
Questions: questions,
|
||||||
|
Teams: teamAnswers,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTeamAnswerScore выставляет балл команде за ответ на вопрос дела;
|
||||||
|
// score == nil сбрасывает балл. Балл может быть любым целым числом
|
||||||
|
// (в т.ч. отрицательным — штрафные баллы). Вопрос должен существовать
|
||||||
|
// в сценарии игры.
|
||||||
|
func (s *GameService) SetTeamAnswerScore(ctx context.Context, teamId int, questionCode string, score *int) error {
|
||||||
|
team, err := s.teamsRepo.GetTeamByID(ctx, teamId)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
game, err := s.gamesRepo.GetGameByID(ctx, team.GameId)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, byCode, err := s.getScenarioQuestionsByCode(ctx, game.ScenarioId)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, ok := byCode[questionCode]; !ok {
|
||||||
|
return ErrQuestionNotFound
|
||||||
|
}
|
||||||
|
return s.answersRepo.SetAnswerScore(ctx, teamId, questionCode, score)
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const defaultCallTimeout = 10 * time.Second
|
|||||||
type GamePlayer interface {
|
type GamePlayer interface {
|
||||||
GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, *game_service.Game, error)
|
GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, *game_service.Game, error)
|
||||||
AddTeamAction(ctx context.Context, teamId int, password, actionCode string) error
|
AddTeamAction(ctx context.Context, teamId int, password, actionCode string) error
|
||||||
|
SubmitTeamAnswers(ctx context.Context, teamId int, password string, answers []game_service.Answer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// MCPService собирает MCP-сервер с игровыми инструментами. Сервис не
|
// MCPService собирает MCP-сервер с игровыми инструментами. Сервис не
|
||||||
@@ -52,7 +53,7 @@ func (s *MCPService) Server() *server.MCPServer {
|
|||||||
srv := server.NewMCPServer(
|
srv := server.NewMCPServer(
|
||||||
"evening-detective-mcp",
|
"evening-detective-mcp",
|
||||||
"0.1.0",
|
"0.1.0",
|
||||||
server.WithInstructions("Инструменты для игры «Вечерний детектив»: подключитесь к игре по ссылке (connect) — организатор выдаёт ссылку вида /team-story/{id}?password=..., — затем смотрите историю команды (get_team_story) и делайте ходы (make_move) по кодам точек сценария."),
|
server.WithInstructions("Инструменты для игры «Вечерний детектив»: подключитесь к игре по ссылке (connect) — организатор выдаёт ссылку вида /team-story/{id}?password=..., — затем смотрите историю команды (get_team_story), делайте ходы (make_move) по кодам точек сценария и отвечайте на вопросы дела (submit_answers)."),
|
||||||
)
|
)
|
||||||
|
|
||||||
srv.AddTool(
|
srv.AddTool(
|
||||||
@@ -85,6 +86,34 @@ func (s *MCPService) Server() *server.MCPServer {
|
|||||||
s.handleMakeMove,
|
s.handleMakeMove,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
srv.AddTool(
|
||||||
|
mcp.NewToolWithRawSchema(
|
||||||
|
"submit_answers",
|
||||||
|
"Отправить ответы команды на вопросы дела (список вопросов — в истории команды через get_team_story). Работает, пока игра идёт; после завершения игры ответы изменить нельзя. После успешной отправки возвращает обновлённую историю команды. Команда идентифицируется паролем.",
|
||||||
|
json.RawMessage(`{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"team_id": {"type": "number", "description": "ID команды"},
|
||||||
|
"password": {"type": "string", "description": "Пароль команды"},
|
||||||
|
"answers": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Ответы команды на вопросы дела; переданные коды перезаписываются, пустая строка очищает ответ",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"questionCode": {"type": "string", "description": "Код вопроса из истории команды"},
|
||||||
|
"answer": {"type": "string", "description": "Текст ответа команды"}
|
||||||
|
},
|
||||||
|
"required": ["questionCode", "answer"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["team_id", "password", "answers"]
|
||||||
|
}`),
|
||||||
|
),
|
||||||
|
s.handleSubmitAnswers,
|
||||||
|
)
|
||||||
|
|
||||||
return srv
|
return srv
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +277,78 @@ func (s *MCPService) handleMakeMove(ctx context.Context, req mcp.CallToolRequest
|
|||||||
return mcp.NewToolResultText(jsonBody), nil
|
return mcp.NewToolResultText(jsonBody), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// submitAnswersArgs — разобранные аргументы инструмента submit_answers.
|
||||||
|
type submitAnswersArgs struct {
|
||||||
|
teamID int64
|
||||||
|
password string
|
||||||
|
answers []game_service.Answer
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseSubmitAnswersArgs разбирает аргументы инструмента submit_answers:
|
||||||
|
// answers — массив объектов {questionCode, answer} (JSON-массив приходит
|
||||||
|
// как []any с map[string]any элементами). Ключ questionCode совпадает с
|
||||||
|
// REST JSON (camelCase) — единый формат для клиентов.
|
||||||
|
func parseSubmitAnswersArgs(args map[string]any) (submitAnswersArgs, error) {
|
||||||
|
teamID, ok := argInt64(args["team_id"])
|
||||||
|
if !ok {
|
||||||
|
return submitAnswersArgs{}, fmt.Errorf("требуется team_id (число)")
|
||||||
|
}
|
||||||
|
password, _ := args["password"].(string)
|
||||||
|
if password == "" {
|
||||||
|
return submitAnswersArgs{}, fmt.Errorf("требуется password")
|
||||||
|
}
|
||||||
|
rawAnswers, ok := args["answers"].([]any)
|
||||||
|
if !ok {
|
||||||
|
return submitAnswersArgs{}, fmt.Errorf("требуется answers (массив ответов)")
|
||||||
|
}
|
||||||
|
answers := make([]game_service.Answer, 0, len(rawAnswers))
|
||||||
|
for i, raw := range rawAnswers {
|
||||||
|
item, ok := raw.(map[string]any)
|
||||||
|
if !ok {
|
||||||
|
return submitAnswersArgs{}, fmt.Errorf("answers[%d]: ожидается объект {questionCode, answer}", i)
|
||||||
|
}
|
||||||
|
questionCode, _ := item["questionCode"].(string)
|
||||||
|
answerText, _ := item["answer"].(string)
|
||||||
|
if questionCode == "" {
|
||||||
|
return submitAnswersArgs{}, fmt.Errorf("answers[%d]: требуется questionCode", i)
|
||||||
|
}
|
||||||
|
answers = append(answers, game_service.Answer{
|
||||||
|
QuestionCode: questionCode,
|
||||||
|
Text: answerText,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return submitAnswersArgs{
|
||||||
|
teamID: teamID,
|
||||||
|
password: password,
|
||||||
|
answers: answers,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *MCPService) handleSubmitAnswers(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
||||||
|
args, err := parseSubmitAnswersArgs(req.GetArguments())
|
||||||
|
if err != nil {
|
||||||
|
return mcp.NewToolResultError(fmt.Sprintf("submit_answers: %v", err)), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, defaultCallTimeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
if err := s.game.SubmitTeamAnswers(ctx, int(args.teamID), args.password, args.answers); err != nil {
|
||||||
|
return mcp.NewToolResultError(fmt.Sprintf("submit_answers: %v", err)), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
story, game, err := s.game.GetTeamActions(ctx, int(args.teamID), args.password)
|
||||||
|
if err != nil {
|
||||||
|
return mcp.NewToolResultError(fmt.Sprintf("submit_answers: %v", err)), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonBody, err := storyJSON(story, game)
|
||||||
|
if err != nil {
|
||||||
|
return mcp.NewToolResultError(fmt.Sprintf("submit_answers: %v", err)), nil
|
||||||
|
}
|
||||||
|
return mcp.NewToolResultText(jsonBody), nil
|
||||||
|
}
|
||||||
|
|
||||||
// argInt64 достаёт int64 из аргумента инструмента: числа приходят как
|
// argInt64 достаёт int64 из аргумента инструмента: числа приходят как
|
||||||
// float64 (JSON), строки — как string.
|
// float64 (JSON), строки — как string.
|
||||||
func argInt64(v any) (int64, bool) {
|
func argInt64(v any) (int64, bool) {
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ func (f *fakeGamePlayer) AddTeamAction(_ context.Context, teamID int, password,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *fakeGamePlayer) SubmitTeamAnswers(_ context.Context, teamID int, password string, answers []game_service.Answer) error {
|
||||||
|
if f.err != nil {
|
||||||
|
return f.err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func defaultStory() *storytelling.Story {
|
func defaultStory() *storytelling.Story {
|
||||||
return &storytelling.Story{
|
return &storytelling.Story{
|
||||||
Introduction: &storytelling.Introduction{
|
Introduction: &storytelling.Introduction{
|
||||||
@@ -136,10 +143,10 @@ func (f *mcpFixture) toolNames(t *testing.T) []string {
|
|||||||
|
|
||||||
func assertExactTools(t *testing.T, names []string) {
|
func assertExactTools(t *testing.T, names []string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if len(names) != 3 {
|
if len(names) != 4 {
|
||||||
t.Fatalf("tools = %v; want ровно 3 инструмента", names)
|
t.Fatalf("tools = %v; want ровно 4 инструмента", names)
|
||||||
}
|
}
|
||||||
for _, want := range []string{"connect", "get_team_story", "make_move"} {
|
for _, want := range []string{"connect", "get_team_story", "make_move", "submit_answers"} {
|
||||||
found := false
|
found := false
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
if name == want {
|
if name == want {
|
||||||
@@ -400,3 +407,56 @@ func TestDefaultCallTimeout(t *testing.T) {
|
|||||||
t.Fatalf("defaultCallTimeout = %v; want 10s", defaultCallTimeout)
|
t.Fatalf("defaultCallTimeout = %v; want 10s", defaultCallTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSubmitAnswers(t *testing.T) {
|
||||||
|
f := newMCPFixture(t, &fakeGamePlayer{story: defaultStory(), game: defaultGame()})
|
||||||
|
|
||||||
|
got := f.call(t, "submit_answers", map[string]any{
|
||||||
|
"team_id": float64(10),
|
||||||
|
"password": "team-pass-1",
|
||||||
|
"answers": []any{
|
||||||
|
map[string]any{"questionCode": "q1", "answer": "Дворецкий"},
|
||||||
|
map[string]any{"questionCode": "q2", "answer": ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if !strings.Contains(got, "entrance") {
|
||||||
|
t.Fatalf("submit_answers: %q; want story JSON в ответе", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSubmitAnswersValidation(t *testing.T) {
|
||||||
|
f := newMCPFixture(t, &fakeGamePlayer{})
|
||||||
|
|
||||||
|
cases := []struct {
|
||||||
|
name string
|
||||||
|
args map[string]any
|
||||||
|
want string
|
||||||
|
}{
|
||||||
|
{"нет team_id", map[string]any{"password": "x", "answers": []any{}}, "team_id"},
|
||||||
|
{"нет password", map[string]any{"team_id": float64(1), "answers": []any{}}, "password"},
|
||||||
|
{"нет answers", map[string]any{"team_id": float64(1), "password": "x"}, "answers"},
|
||||||
|
{"элемент не объект", map[string]any{"team_id": float64(1), "password": "x", "answers": []any{"str"}}, "answers[0]"},
|
||||||
|
{"нет questionCode", map[string]any{"team_id": float64(1), "password": "x", "answers": []any{map[string]any{"answer": "x"}}}, "questionCode"},
|
||||||
|
}
|
||||||
|
for _, tc := range cases {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
got := f.call(t, "submit_answers", tc.args)
|
||||||
|
if !strings.Contains(got, tc.want) {
|
||||||
|
t.Fatalf("submit_answers: %q; want подстроку %q", got, tc.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSubmitAnswersBusinessError(t *testing.T) {
|
||||||
|
f := newMCPFixture(t, &fakeGamePlayer{err: errors.New("Игра завершена, ответы больше нельзя изменять")})
|
||||||
|
|
||||||
|
got := f.call(t, "submit_answers", map[string]any{
|
||||||
|
"team_id": float64(10),
|
||||||
|
"password": "wrong",
|
||||||
|
"answers": []any{map[string]any{"questionCode": "q1", "answer": "x"}},
|
||||||
|
})
|
||||||
|
if !strings.Contains(got, "Игра завершена") {
|
||||||
|
t.Fatalf("submit_answers с ошибкой сервиса: %q; want error text", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -295,6 +295,75 @@ func (s *ScenarioService) UpdateScenarioIntro(
|
|||||||
return s.updateStory(ctx, id, story)
|
return s.updateStory(ctx, id, story)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddScenarioQuestion добавляет вопрос дела в конец списка вопросов сценария.
|
||||||
|
func (s *ScenarioService) AddScenarioQuestion(
|
||||||
|
ctx context.Context,
|
||||||
|
id int,
|
||||||
|
question *storytelling.Question,
|
||||||
|
actorId int,
|
||||||
|
isAdmin bool,
|
||||||
|
) error {
|
||||||
|
if _, err := s.getScenarioForChange(ctx, id, actorId, isAdmin); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
story, err := s.getStory(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
story.Questions = append(story.Questions, question)
|
||||||
|
return s.updateStory(ctx, id, story)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScenarioQuestion обновляет вопрос дела по его коду. Смена кода
|
||||||
|
// оставляет строки team_answers старого кода в БД
|
||||||
|
func (s *ScenarioService) UpdateScenarioQuestion(
|
||||||
|
ctx context.Context,
|
||||||
|
id int,
|
||||||
|
code string,
|
||||||
|
question *storytelling.Question,
|
||||||
|
actorId int,
|
||||||
|
isAdmin bool,
|
||||||
|
) error {
|
||||||
|
if _, err := s.getScenarioForChange(ctx, id, actorId, isAdmin); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
story, err := s.getStory(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for i := range story.Questions {
|
||||||
|
if story.Questions[i].Code == code {
|
||||||
|
story.Questions[i] = question
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.updateStory(ctx, id, story)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteScenarioQuestion удаляет вопрос дела по его коду.
|
||||||
|
func (s *ScenarioService) DeleteScenarioQuestion(
|
||||||
|
ctx context.Context,
|
||||||
|
id int,
|
||||||
|
code string,
|
||||||
|
actorId int,
|
||||||
|
isAdmin bool,
|
||||||
|
) error {
|
||||||
|
if _, err := s.getScenarioForChange(ctx, id, actorId, isAdmin); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
story, err := s.getStory(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for i := range story.Questions {
|
||||||
|
if story.Questions[i].Code == code {
|
||||||
|
story.Questions = append(story.Questions[:i], story.Questions[i+1:]...)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.updateStory(ctx, id, story)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *ScenarioService) getStory(ctx context.Context, id int) (*storytelling.Story, error) {
|
func (s *ScenarioService) getStory(ctx context.Context, id int) (*storytelling.Story, error) {
|
||||||
storyString, err := s.scenariosRepo.GetStoryByScenarioID(ctx, id)
|
storyString, err := s.scenariosRepo.GetStoryByScenarioID(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -432,7 +501,6 @@ func (s *ScenarioService) UploadArchive(
|
|||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error {
|
func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error {
|
||||||
for _, place := range story.Places {
|
for _, place := range story.Places {
|
||||||
place.Image = strings.TrimPrefix(place.Image, s.domain)
|
place.Image = strings.TrimPrefix(place.Image, s.domain)
|
||||||
@@ -478,6 +546,23 @@ func normalizeStory(story *storytelling.Story) (string, error) {
|
|||||||
}
|
}
|
||||||
story.Places = cleanPlaces
|
story.Places = cleanPlaces
|
||||||
|
|
||||||
|
// Коды вопросов уникальны, пустые коды отбрасываются (как у точек).
|
||||||
|
questionCodes := map[string]struct{}{}
|
||||||
|
for _, question := range story.Questions {
|
||||||
|
questionCodes[question.Code] = struct{}{}
|
||||||
|
}
|
||||||
|
if len(questionCodes) != len(story.Questions) {
|
||||||
|
return "", errors.New("Такой код вопроса уже существует")
|
||||||
|
}
|
||||||
|
cleanQuestions := make([]*storytelling.Question, 0, len(story.Questions))
|
||||||
|
for _, question := range story.Questions {
|
||||||
|
if question.Code == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
cleanQuestions = append(cleanQuestions, question)
|
||||||
|
}
|
||||||
|
story.Questions = cleanQuestions
|
||||||
|
|
||||||
return convertStory(story)
|
return convertStory(story)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -686,3 +686,132 @@ func mustJSON(t *testing.T, v scenario_archive.ScenarioJSON) []byte {
|
|||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestScenarioQuestionsCRUD(t *testing.T) {
|
||||||
|
repo := newFakeScenariosRepo()
|
||||||
|
storage := newFakeStorage()
|
||||||
|
seedScenario(t, repo, storage)
|
||||||
|
svc := newTestService(repo, storage)
|
||||||
|
|
||||||
|
// Добавление вопроса автором.
|
||||||
|
err := svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Кто убийца?",
|
||||||
|
Answer: "Дворецкий",
|
||||||
|
}, 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("AddScenarioQuestion: %v", err)
|
||||||
|
}
|
||||||
|
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{
|
||||||
|
Code: "q2",
|
||||||
|
Text: "Орудие?",
|
||||||
|
Answer: "Канделябр",
|
||||||
|
}, 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("AddScenarioQuestion: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
full, err := svc.GetFullScenarioByID(context.Background(), 1)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("GetFullScenarioByID: %v", err)
|
||||||
|
}
|
||||||
|
if len(full.Story.Questions) != 2 {
|
||||||
|
t.Fatalf("len(Questions) = %d, want 2", len(full.Story.Questions))
|
||||||
|
}
|
||||||
|
// Вопросы добавляются в конец списка: q1 добавлен первым.
|
||||||
|
if full.Story.Questions[0].Code != "q1" || full.Story.Questions[0].Answer != "Дворецкий" {
|
||||||
|
t.Errorf("Questions[0] = %+v, want q1 с правильным ответом", full.Story.Questions[0])
|
||||||
|
}
|
||||||
|
if full.Story.Questions[1].Code != "q2" || full.Story.Questions[1].Answer != "Канделябр" {
|
||||||
|
t.Errorf("Questions[1] = %+v, want q2 с правильным ответом", full.Story.Questions[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновление вопроса по коду.
|
||||||
|
err = svc.UpdateScenarioQuestion(context.Background(), 1, "q1", &storytelling.Question{
|
||||||
|
Code: "q1",
|
||||||
|
Text: "Кто убийца на самом деле?",
|
||||||
|
Answer: "Экономка",
|
||||||
|
}, 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("UpdateScenarioQuestion: %v", err)
|
||||||
|
}
|
||||||
|
full, err = svc.GetFullScenarioByID(context.Background(), 1)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("GetFullScenarioByID: %v", err)
|
||||||
|
}
|
||||||
|
found := false
|
||||||
|
for _, q := range full.Story.Questions {
|
||||||
|
if q.Code == "q1" {
|
||||||
|
found = true
|
||||||
|
if q.Text != "Кто убийца на самом деле?" || q.Answer != "Экономка" {
|
||||||
|
t.Errorf("q1 = %+v, want обновлённый вопрос", q)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
t.Error("вопрос q1 не найден после обновления")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Удаление вопроса.
|
||||||
|
err = svc.DeleteScenarioQuestion(context.Background(), 1, "q2", 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("DeleteScenarioQuestion: %v", err)
|
||||||
|
}
|
||||||
|
full, err = svc.GetFullScenarioByID(context.Background(), 1)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("GetFullScenarioByID: %v", err)
|
||||||
|
}
|
||||||
|
if len(full.Story.Questions) != 1 || full.Story.Questions[0].Code != "q1" {
|
||||||
|
t.Errorf("Questions = %+v, want только q1", full.Story.Questions)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Чужой автор не может менять вопросы.
|
||||||
|
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{Code: "q3"}, 99, false)
|
||||||
|
if !errors.Is(err, ErrScenarioNotOwner) {
|
||||||
|
t.Errorf("AddScenarioQuestion чужой автор: err = %v, want ErrScenarioNotOwner", err)
|
||||||
|
}
|
||||||
|
err = svc.DeleteScenarioQuestion(context.Background(), 1, "q1", 99, false)
|
||||||
|
if !errors.Is(err, ErrScenarioNotOwner) {
|
||||||
|
t.Errorf("DeleteScenarioQuestion чужой автор: err = %v, want ErrScenarioNotOwner", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Админ может менять вопросы чужого сценария.
|
||||||
|
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{
|
||||||
|
Code: "q3", Text: "Вопрос админа",
|
||||||
|
}, 1, true)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("AddScenarioQuestion админ: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNormalizeStoryQuestionCodes(t *testing.T) {
|
||||||
|
repo := newFakeScenariosRepo()
|
||||||
|
storage := newFakeStorage()
|
||||||
|
seedScenario(t, repo, storage)
|
||||||
|
svc := newTestService(repo, storage)
|
||||||
|
|
||||||
|
// Дубликат кода вопроса — ошибка.
|
||||||
|
err := svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{Code: "q1"}, 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("AddScenarioQuestion q1: %v", err)
|
||||||
|
}
|
||||||
|
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{Code: "q1"}, 7, false)
|
||||||
|
if err == nil || !strings.Contains(err.Error(), "Такой код вопроса уже существует") {
|
||||||
|
t.Errorf("AddScenarioQuestion с дублем кода: err = %v, want ошибку о дубле", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Пустой код — вопрос отбрасывается при сохранении.
|
||||||
|
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{Code: "", Text: "без кода"}, 7, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("AddScenarioQuestion с пустым кодом: %v", err)
|
||||||
|
}
|
||||||
|
full, err := svc.GetFullScenarioByID(context.Background(), 1)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("GetFullScenarioByID: %v", err)
|
||||||
|
}
|
||||||
|
for _, q := range full.Story.Questions {
|
||||||
|
if q.Code == "" {
|
||||||
|
t.Error("вопрос с пустым кодом сохранился")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
-- +goose Up
|
||||||
|
CREATE TABLE
|
||||||
|
IF NOT EXISTS team_answers (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
team_id INTEGER NOT NULL,
|
||||||
|
question_code TEXT NOT NULL,
|
||||||
|
answer TEXT NOT NULL DEFAULT '',
|
||||||
|
score INTEGER,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW (),
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT NOW (),
|
||||||
|
|
||||||
|
CONSTRAINT fk_team_answers_team FOREIGN KEY (team_id) REFERENCES teams (id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT uq_team_answer UNIQUE (team_id, question_code)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
DROP TABLE IF EXISTS team_answers;
|
||||||
+1433
-360
File diff suppressed because it is too large
Load Diff
@@ -1024,6 +1024,167 @@ func local_request_EveningDetectiveServer_DeleteScenarioPlace_0(ctx context.Cont
|
|||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_AddScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq AddScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
msg, err := client.AddScenarioQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_AddScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq AddScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
msg, err := server.AddScenarioQuestion(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_UpdateScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq UpdateScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["code"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code")
|
||||||
|
}
|
||||||
|
protoReq.Code, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code", err)
|
||||||
|
}
|
||||||
|
msg, err := client.UpdateScenarioQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_UpdateScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq UpdateScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["code"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code")
|
||||||
|
}
|
||||||
|
protoReq.Code, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code", err)
|
||||||
|
}
|
||||||
|
msg, err := server.UpdateScenarioQuestion(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_DeleteScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq DeleteScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["code"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code")
|
||||||
|
}
|
||||||
|
protoReq.Code, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code", err)
|
||||||
|
}
|
||||||
|
msg, err := client.DeleteScenarioQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_DeleteScenarioQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq DeleteScenarioQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["code"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "code")
|
||||||
|
}
|
||||||
|
protoReq.Code, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "code", err)
|
||||||
|
}
|
||||||
|
msg, err := server.DeleteScenarioQuestion(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
func request_EveningDetectiveServer_UpdateScenarioIntro_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_EveningDetectiveServer_UpdateScenarioIntro_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var (
|
var (
|
||||||
protoReq UpdateScenarioIntroReq
|
protoReq UpdateScenarioIntroReq
|
||||||
@@ -1222,6 +1383,45 @@ func local_request_EveningDetectiveServer_GetGame_0(ctx context.Context, marshal
|
|||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_GetGameAnswers_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetGameAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["gameId"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gameId")
|
||||||
|
}
|
||||||
|
protoReq.GameId, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gameId", err)
|
||||||
|
}
|
||||||
|
msg, err := client.GetGameAnswers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_GetGameAnswers_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetGameAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
val, ok := pathParams["gameId"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "gameId")
|
||||||
|
}
|
||||||
|
protoReq.GameId, err = runtime.Int32(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "gameId", err)
|
||||||
|
}
|
||||||
|
msg, err := server.GetGameAnswers(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
func request_EveningDetectiveServer_UpdateGame_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_EveningDetectiveServer_UpdateGame_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var (
|
var (
|
||||||
protoReq UpdateGameReq
|
protoReq UpdateGameReq
|
||||||
@@ -1824,6 +2024,165 @@ func local_request_EveningDetectiveServer_DeleteLastTeamAction_0(ctx context.Con
|
|||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var filter_EveningDetectiveServer_GetTeamAnswers_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_GetTeamAnswers_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetTeamAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamAnswers_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := client.GetTeamAnswers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_GetTeamAnswers_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetTeamAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
if err := req.ParseForm(); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamAnswers_0); err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := server.GetTeamAnswers(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_SubmitTeamAnswers_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq SubmitTeamAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
msg, err := client.SubmitTeamAnswers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_SubmitTeamAnswers_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq SubmitTeamAnswersReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
msg, err := server.SubmitTeamAnswers(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_EveningDetectiveServer_SetTeamAnswerScore_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq SetTeamAnswerScoreReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
if req.Body != nil {
|
||||||
|
_, _ = io.Copy(io.Discard, req.Body)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["questionCode"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "questionCode")
|
||||||
|
}
|
||||||
|
protoReq.QuestionCode, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "questionCode", err)
|
||||||
|
}
|
||||||
|
msg, err := client.SetTeamAnswerScore(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_EveningDetectiveServer_SetTeamAnswerScore_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq SetTeamAnswerScoreReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
val, ok := pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
val, ok = pathParams["questionCode"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "questionCode")
|
||||||
|
}
|
||||||
|
protoReq.QuestionCode, err = runtime.String(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "questionCode", err)
|
||||||
|
}
|
||||||
|
msg, err := server.SetTeamAnswerScore(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterEveningDetectiveServerHandlerServer registers the http handlers for service EveningDetectiveServer to "mux".
|
// RegisterEveningDetectiveServerHandlerServer registers the http handlers for service EveningDetectiveServer to "mux".
|
||||||
// UnaryRPC :call EveningDetectiveServerServer directly.
|
// UnaryRPC :call EveningDetectiveServerServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
@@ -2430,6 +2789,66 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_DeleteScenarioPlace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_DeleteScenarioPlace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_AddScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/AddScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_AddScenarioQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_AddScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions/{code}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_UpdateScenarioQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_UpdateScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodDelete, pattern_EveningDetectiveServer_DeleteScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/DeleteScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions/{code}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_DeleteScenarioQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_DeleteScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioIntro_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioIntro_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -2550,6 +2969,26 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetGameAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetGameAnswers", runtime.WithHTTPPathPattern("/api/games/{gameId}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_GetGameAnswers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_GetGameAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -2830,6 +3269,66 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_DeleteLastTeamAction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_DeleteLastTeamAction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamAnswers", runtime.WithHTTPPathPattern("/api/teams/{id}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_GetTeamAnswers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_GetTeamAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_SubmitTeamAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/SubmitTeamAnswers", runtime.WithHTTPPathPattern("/api/teams/{id}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_SubmitTeamAnswers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_SubmitTeamAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_SetTeamAnswerScore_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/SetTeamAnswerScore", runtime.WithHTTPPathPattern("/api/teams/{id}/answers/{questionCode}/score"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_EveningDetectiveServer_SetTeamAnswerScore_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_SetTeamAnswerScore_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -3380,6 +3879,57 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_DeleteScenarioPlace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_DeleteScenarioPlace_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_AddScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/AddScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_AddScenarioQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_AddScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions/{code}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_UpdateScenarioQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_UpdateScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodDelete, pattern_EveningDetectiveServer_DeleteScenarioQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/DeleteScenarioQuestion", runtime.WithHTTPPathPattern("/api/scenarios/{id}/questions/{code}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_DeleteScenarioQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_DeleteScenarioQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioIntro_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateScenarioIntro_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -3482,6 +4032,23 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetGameAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetGameAnswers", runtime.WithHTTPPathPattern("/api/games/{gameId}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_GetGameAnswers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_GetGameAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_UpdateGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -3720,6 +4287,57 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti
|
|||||||
}
|
}
|
||||||
forward_EveningDetectiveServer_DeleteLastTeamAction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_EveningDetectiveServer_DeleteLastTeamAction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamAnswers", runtime.WithHTTPPathPattern("/api/teams/{id}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_GetTeamAnswers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_GetTeamAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_SubmitTeamAnswers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/SubmitTeamAnswers", runtime.WithHTTPPathPattern("/api/teams/{id}/answers"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_SubmitTeamAnswers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_SubmitTeamAnswers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPut, pattern_EveningDetectiveServer_SetTeamAnswerScore_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/SetTeamAnswerScore", runtime.WithHTTPPathPattern("/api/teams/{id}/answers/{questionCode}/score"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_EveningDetectiveServer_SetTeamAnswerScore_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_EveningDetectiveServer_SetTeamAnswerScore_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3754,12 +4372,16 @@ var (
|
|||||||
pattern_EveningDetectiveServer_AddScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "places"}, ""))
|
pattern_EveningDetectiveServer_AddScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "places"}, ""))
|
||||||
pattern_EveningDetectiveServer_UpdateScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "places", "code"}, ""))
|
pattern_EveningDetectiveServer_UpdateScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "places", "code"}, ""))
|
||||||
pattern_EveningDetectiveServer_DeleteScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "places", "code"}, ""))
|
pattern_EveningDetectiveServer_DeleteScenarioPlace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "places", "code"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_AddScenarioQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "questions"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_UpdateScenarioQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "questions", "code"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_DeleteScenarioQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"api", "scenarios", "id", "questions", "code"}, ""))
|
||||||
pattern_EveningDetectiveServer_UpdateScenarioIntro_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "introduction"}, ""))
|
pattern_EveningDetectiveServer_UpdateScenarioIntro_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "introduction"}, ""))
|
||||||
pattern_EveningDetectiveServer_DownloadScenarioArchive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "archive"}, ""))
|
pattern_EveningDetectiveServer_DownloadScenarioArchive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "scenarios", "id", "archive"}, ""))
|
||||||
pattern_EveningDetectiveServer_UploadScenarioArchive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "scenarios", "archive"}, ""))
|
pattern_EveningDetectiveServer_UploadScenarioArchive_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "scenarios", "archive"}, ""))
|
||||||
pattern_EveningDetectiveServer_AddGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
|
pattern_EveningDetectiveServer_AddGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
|
||||||
pattern_EveningDetectiveServer_GetGames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
|
pattern_EveningDetectiveServer_GetGames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
|
||||||
pattern_EveningDetectiveServer_GetGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "games", "id"}, ""))
|
pattern_EveningDetectiveServer_GetGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "games", "id"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_GetGameAnswers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "gameId", "answers"}, ""))
|
||||||
pattern_EveningDetectiveServer_UpdateGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "games", "id"}, ""))
|
pattern_EveningDetectiveServer_UpdateGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "games", "id"}, ""))
|
||||||
pattern_EveningDetectiveServer_StartGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "id", "start"}, ""))
|
pattern_EveningDetectiveServer_StartGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "id", "start"}, ""))
|
||||||
pattern_EveningDetectiveServer_PauseGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "id", "pause"}, ""))
|
pattern_EveningDetectiveServer_PauseGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "id", "pause"}, ""))
|
||||||
@@ -3774,6 +4396,9 @@ var (
|
|||||||
pattern_EveningDetectiveServer_GetTeamStory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "story"}, ""))
|
pattern_EveningDetectiveServer_GetTeamStory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "story"}, ""))
|
||||||
pattern_EveningDetectiveServer_AddTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "actions"}, ""))
|
pattern_EveningDetectiveServer_AddTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "actions"}, ""))
|
||||||
pattern_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "last-actions"}, ""))
|
pattern_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "last-actions"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_GetTeamAnswers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "answers"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_SubmitTeamAnswers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "answers"}, ""))
|
||||||
|
pattern_EveningDetectiveServer_SetTeamAnswerScore_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"api", "teams", "id", "answers", "questionCode", "score"}, ""))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -3807,12 +4432,16 @@ var (
|
|||||||
forward_EveningDetectiveServer_AddScenarioPlace_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_AddScenarioPlace_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_UpdateScenarioPlace_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_UpdateScenarioPlace_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_DeleteScenarioPlace_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_DeleteScenarioPlace_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_AddScenarioQuestion_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_UpdateScenarioQuestion_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_DeleteScenarioQuestion_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_UpdateScenarioIntro_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_UpdateScenarioIntro_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_DownloadScenarioArchive_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_DownloadScenarioArchive_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_UploadScenarioArchive_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_UploadScenarioArchive_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_AddGame_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_AddGame_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_GetGames_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_GetGames_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_GetGame_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_GetGame_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_GetGameAnswers_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_UpdateGame_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_UpdateGame_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_StartGame_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_StartGame_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_PauseGame_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_PauseGame_0 = runtime.ForwardResponseMessage
|
||||||
@@ -3827,4 +4456,7 @@ var (
|
|||||||
forward_EveningDetectiveServer_GetTeamStory_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_GetTeamStory_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_AddTeamAction_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_AddTeamAction_0 = runtime.ForwardResponseMessage
|
||||||
forward_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.ForwardResponseMessage
|
forward_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_GetTeamAnswers_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_SubmitTeamAnswers_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_EveningDetectiveServer_SetTeamAnswerScore_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,12 +50,16 @@ const (
|
|||||||
EveningDetectiveServer_AddScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddScenarioPlace"
|
EveningDetectiveServer_AddScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddScenarioPlace"
|
||||||
EveningDetectiveServer_UpdateScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioPlace"
|
EveningDetectiveServer_UpdateScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioPlace"
|
||||||
EveningDetectiveServer_DeleteScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteScenarioPlace"
|
EveningDetectiveServer_DeleteScenarioPlace_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteScenarioPlace"
|
||||||
|
EveningDetectiveServer_AddScenarioQuestion_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddScenarioQuestion"
|
||||||
|
EveningDetectiveServer_UpdateScenarioQuestion_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioQuestion"
|
||||||
|
EveningDetectiveServer_DeleteScenarioQuestion_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteScenarioQuestion"
|
||||||
EveningDetectiveServer_UpdateScenarioIntro_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioIntro"
|
EveningDetectiveServer_UpdateScenarioIntro_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateScenarioIntro"
|
||||||
EveningDetectiveServer_DownloadScenarioArchive_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DownloadScenarioArchive"
|
EveningDetectiveServer_DownloadScenarioArchive_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DownloadScenarioArchive"
|
||||||
EveningDetectiveServer_UploadScenarioArchive_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UploadScenarioArchive"
|
EveningDetectiveServer_UploadScenarioArchive_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UploadScenarioArchive"
|
||||||
EveningDetectiveServer_AddGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddGame"
|
EveningDetectiveServer_AddGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddGame"
|
||||||
EveningDetectiveServer_GetGames_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGames"
|
EveningDetectiveServer_GetGames_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGames"
|
||||||
EveningDetectiveServer_GetGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGame"
|
EveningDetectiveServer_GetGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGame"
|
||||||
|
EveningDetectiveServer_GetGameAnswers_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGameAnswers"
|
||||||
EveningDetectiveServer_UpdateGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateGame"
|
EveningDetectiveServer_UpdateGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateGame"
|
||||||
EveningDetectiveServer_StartGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/StartGame"
|
EveningDetectiveServer_StartGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/StartGame"
|
||||||
EveningDetectiveServer_PauseGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/PauseGame"
|
EveningDetectiveServer_PauseGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/PauseGame"
|
||||||
@@ -70,6 +74,9 @@ const (
|
|||||||
EveningDetectiveServer_GetTeamStory_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory"
|
EveningDetectiveServer_GetTeamStory_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory"
|
||||||
EveningDetectiveServer_AddTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction"
|
EveningDetectiveServer_AddTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction"
|
||||||
EveningDetectiveServer_DeleteLastTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteLastTeamAction"
|
EveningDetectiveServer_DeleteLastTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteLastTeamAction"
|
||||||
|
EveningDetectiveServer_GetTeamAnswers_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamAnswers"
|
||||||
|
EveningDetectiveServer_SubmitTeamAnswers_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/SubmitTeamAnswers"
|
||||||
|
EveningDetectiveServer_SetTeamAnswerScore_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/SetTeamAnswerScore"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
|
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
|
||||||
@@ -106,12 +113,16 @@ type EveningDetectiveServerClient interface {
|
|||||||
AddScenarioPlace(ctx context.Context, in *AddScenarioPlaceReq, opts ...grpc.CallOption) (*AddScenarioPlaceRsp, error)
|
AddScenarioPlace(ctx context.Context, in *AddScenarioPlaceReq, opts ...grpc.CallOption) (*AddScenarioPlaceRsp, error)
|
||||||
UpdateScenarioPlace(ctx context.Context, in *UpdateScenarioPlaceReq, opts ...grpc.CallOption) (*UpdateScenarioPlaceRsp, error)
|
UpdateScenarioPlace(ctx context.Context, in *UpdateScenarioPlaceReq, opts ...grpc.CallOption) (*UpdateScenarioPlaceRsp, error)
|
||||||
DeleteScenarioPlace(ctx context.Context, in *DeleteScenarioPlaceReq, opts ...grpc.CallOption) (*DeleteScenarioPlaceRsp, error)
|
DeleteScenarioPlace(ctx context.Context, in *DeleteScenarioPlaceReq, opts ...grpc.CallOption) (*DeleteScenarioPlaceRsp, error)
|
||||||
|
AddScenarioQuestion(ctx context.Context, in *AddScenarioQuestionReq, opts ...grpc.CallOption) (*AddScenarioQuestionRsp, error)
|
||||||
|
UpdateScenarioQuestion(ctx context.Context, in *UpdateScenarioQuestionReq, opts ...grpc.CallOption) (*UpdateScenarioQuestionRsp, error)
|
||||||
|
DeleteScenarioQuestion(ctx context.Context, in *DeleteScenarioQuestionReq, opts ...grpc.CallOption) (*DeleteScenarioQuestionRsp, error)
|
||||||
UpdateScenarioIntro(ctx context.Context, in *UpdateScenarioIntroReq, opts ...grpc.CallOption) (*UpdateScenarioIntroRsp, error)
|
UpdateScenarioIntro(ctx context.Context, in *UpdateScenarioIntroReq, opts ...grpc.CallOption) (*UpdateScenarioIntroRsp, error)
|
||||||
DownloadScenarioArchive(ctx context.Context, in *DownloadScenarioArchiveReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
|
DownloadScenarioArchive(ctx context.Context, in *DownloadScenarioArchiveReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
|
||||||
UploadScenarioArchive(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (*UploadScenarioArchiveRsp, error)
|
UploadScenarioArchive(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (*UploadScenarioArchiveRsp, error)
|
||||||
AddGame(ctx context.Context, in *AddGameReq, opts ...grpc.CallOption) (*AddGameRsp, error)
|
AddGame(ctx context.Context, in *AddGameReq, opts ...grpc.CallOption) (*AddGameRsp, error)
|
||||||
GetGames(ctx context.Context, in *GetGamesReq, opts ...grpc.CallOption) (*GetGamesRsp, error)
|
GetGames(ctx context.Context, in *GetGamesReq, opts ...grpc.CallOption) (*GetGamesRsp, error)
|
||||||
GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error)
|
GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error)
|
||||||
|
GetGameAnswers(ctx context.Context, in *GetGameAnswersReq, opts ...grpc.CallOption) (*GetGameAnswersRsp, error)
|
||||||
UpdateGame(ctx context.Context, in *UpdateGameReq, opts ...grpc.CallOption) (*UpdateGameRsp, error)
|
UpdateGame(ctx context.Context, in *UpdateGameReq, opts ...grpc.CallOption) (*UpdateGameRsp, error)
|
||||||
StartGame(ctx context.Context, in *StartGameReq, opts ...grpc.CallOption) (*StartGameRsp, error)
|
StartGame(ctx context.Context, in *StartGameReq, opts ...grpc.CallOption) (*StartGameRsp, error)
|
||||||
PauseGame(ctx context.Context, in *PauseGameReq, opts ...grpc.CallOption) (*PauseGameRsp, error)
|
PauseGame(ctx context.Context, in *PauseGameReq, opts ...grpc.CallOption) (*PauseGameRsp, error)
|
||||||
@@ -126,6 +137,9 @@ type EveningDetectiveServerClient interface {
|
|||||||
GetTeamStory(ctx context.Context, in *GetTeamStoryReq, opts ...grpc.CallOption) (*GetTeamStoryRsp, error)
|
GetTeamStory(ctx context.Context, in *GetTeamStoryReq, opts ...grpc.CallOption) (*GetTeamStoryRsp, error)
|
||||||
AddTeamAction(ctx context.Context, in *AddTeamActionReq, opts ...grpc.CallOption) (*AddTeamActionRsp, error)
|
AddTeamAction(ctx context.Context, in *AddTeamActionReq, opts ...grpc.CallOption) (*AddTeamActionRsp, error)
|
||||||
DeleteLastTeamAction(ctx context.Context, in *DeleteLastTeamActionReq, opts ...grpc.CallOption) (*DeleteLastTeamActionRsp, error)
|
DeleteLastTeamAction(ctx context.Context, in *DeleteLastTeamActionReq, opts ...grpc.CallOption) (*DeleteLastTeamActionRsp, error)
|
||||||
|
GetTeamAnswers(ctx context.Context, in *GetTeamAnswersReq, opts ...grpc.CallOption) (*GetTeamAnswersRsp, error)
|
||||||
|
SubmitTeamAnswers(ctx context.Context, in *SubmitTeamAnswersReq, opts ...grpc.CallOption) (*SubmitTeamAnswersRsp, error)
|
||||||
|
SetTeamAnswerScore(ctx context.Context, in *SetTeamAnswerScoreReq, opts ...grpc.CallOption) (*SetTeamAnswerScoreRsp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type eveningDetectiveServerClient struct {
|
type eveningDetectiveServerClient struct {
|
||||||
@@ -436,6 +450,36 @@ func (c *eveningDetectiveServerClient) DeleteScenarioPlace(ctx context.Context,
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) AddScenarioQuestion(ctx context.Context, in *AddScenarioQuestionReq, opts ...grpc.CallOption) (*AddScenarioQuestionRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AddScenarioQuestionRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_AddScenarioQuestion_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) UpdateScenarioQuestion(ctx context.Context, in *UpdateScenarioQuestionReq, opts ...grpc.CallOption) (*UpdateScenarioQuestionRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(UpdateScenarioQuestionRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_UpdateScenarioQuestion_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) DeleteScenarioQuestion(ctx context.Context, in *DeleteScenarioQuestionReq, opts ...grpc.CallOption) (*DeleteScenarioQuestionRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(DeleteScenarioQuestionRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_DeleteScenarioQuestion_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *eveningDetectiveServerClient) UpdateScenarioIntro(ctx context.Context, in *UpdateScenarioIntroReq, opts ...grpc.CallOption) (*UpdateScenarioIntroRsp, error) {
|
func (c *eveningDetectiveServerClient) UpdateScenarioIntro(ctx context.Context, in *UpdateScenarioIntroReq, opts ...grpc.CallOption) (*UpdateScenarioIntroRsp, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(UpdateScenarioIntroRsp)
|
out := new(UpdateScenarioIntroRsp)
|
||||||
@@ -496,6 +540,16 @@ func (c *eveningDetectiveServerClient) GetGame(ctx context.Context, in *GetGameR
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) GetGameAnswers(ctx context.Context, in *GetGameAnswersReq, opts ...grpc.CallOption) (*GetGameAnswersRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetGameAnswersRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_GetGameAnswers_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *eveningDetectiveServerClient) UpdateGame(ctx context.Context, in *UpdateGameReq, opts ...grpc.CallOption) (*UpdateGameRsp, error) {
|
func (c *eveningDetectiveServerClient) UpdateGame(ctx context.Context, in *UpdateGameReq, opts ...grpc.CallOption) (*UpdateGameRsp, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(UpdateGameRsp)
|
out := new(UpdateGameRsp)
|
||||||
@@ -636,6 +690,36 @@ func (c *eveningDetectiveServerClient) DeleteLastTeamAction(ctx context.Context,
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) GetTeamAnswers(ctx context.Context, in *GetTeamAnswersReq, opts ...grpc.CallOption) (*GetTeamAnswersRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetTeamAnswersRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_GetTeamAnswers_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) SubmitTeamAnswers(ctx context.Context, in *SubmitTeamAnswersReq, opts ...grpc.CallOption) (*SubmitTeamAnswersRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(SubmitTeamAnswersRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_SubmitTeamAnswers_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *eveningDetectiveServerClient) SetTeamAnswerScore(ctx context.Context, in *SetTeamAnswerScoreReq, opts ...grpc.CallOption) (*SetTeamAnswerScoreRsp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(SetTeamAnswerScoreRsp)
|
||||||
|
err := c.cc.Invoke(ctx, EveningDetectiveServer_SetTeamAnswerScore_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
|
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
|
||||||
// All implementations must embed UnimplementedEveningDetectiveServerServer
|
// All implementations must embed UnimplementedEveningDetectiveServerServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@@ -670,12 +754,16 @@ type EveningDetectiveServerServer interface {
|
|||||||
AddScenarioPlace(context.Context, *AddScenarioPlaceReq) (*AddScenarioPlaceRsp, error)
|
AddScenarioPlace(context.Context, *AddScenarioPlaceReq) (*AddScenarioPlaceRsp, error)
|
||||||
UpdateScenarioPlace(context.Context, *UpdateScenarioPlaceReq) (*UpdateScenarioPlaceRsp, error)
|
UpdateScenarioPlace(context.Context, *UpdateScenarioPlaceReq) (*UpdateScenarioPlaceRsp, error)
|
||||||
DeleteScenarioPlace(context.Context, *DeleteScenarioPlaceReq) (*DeleteScenarioPlaceRsp, error)
|
DeleteScenarioPlace(context.Context, *DeleteScenarioPlaceReq) (*DeleteScenarioPlaceRsp, error)
|
||||||
|
AddScenarioQuestion(context.Context, *AddScenarioQuestionReq) (*AddScenarioQuestionRsp, error)
|
||||||
|
UpdateScenarioQuestion(context.Context, *UpdateScenarioQuestionReq) (*UpdateScenarioQuestionRsp, error)
|
||||||
|
DeleteScenarioQuestion(context.Context, *DeleteScenarioQuestionReq) (*DeleteScenarioQuestionRsp, error)
|
||||||
UpdateScenarioIntro(context.Context, *UpdateScenarioIntroReq) (*UpdateScenarioIntroRsp, error)
|
UpdateScenarioIntro(context.Context, *UpdateScenarioIntroReq) (*UpdateScenarioIntroRsp, error)
|
||||||
DownloadScenarioArchive(context.Context, *DownloadScenarioArchiveReq) (*httpbody.HttpBody, error)
|
DownloadScenarioArchive(context.Context, *DownloadScenarioArchiveReq) (*httpbody.HttpBody, error)
|
||||||
UploadScenarioArchive(context.Context, *httpbody.HttpBody) (*UploadScenarioArchiveRsp, error)
|
UploadScenarioArchive(context.Context, *httpbody.HttpBody) (*UploadScenarioArchiveRsp, error)
|
||||||
AddGame(context.Context, *AddGameReq) (*AddGameRsp, error)
|
AddGame(context.Context, *AddGameReq) (*AddGameRsp, error)
|
||||||
GetGames(context.Context, *GetGamesReq) (*GetGamesRsp, error)
|
GetGames(context.Context, *GetGamesReq) (*GetGamesRsp, error)
|
||||||
GetGame(context.Context, *GetGameReq) (*GetGameRsp, error)
|
GetGame(context.Context, *GetGameReq) (*GetGameRsp, error)
|
||||||
|
GetGameAnswers(context.Context, *GetGameAnswersReq) (*GetGameAnswersRsp, error)
|
||||||
UpdateGame(context.Context, *UpdateGameReq) (*UpdateGameRsp, error)
|
UpdateGame(context.Context, *UpdateGameReq) (*UpdateGameRsp, error)
|
||||||
StartGame(context.Context, *StartGameReq) (*StartGameRsp, error)
|
StartGame(context.Context, *StartGameReq) (*StartGameRsp, error)
|
||||||
PauseGame(context.Context, *PauseGameReq) (*PauseGameRsp, error)
|
PauseGame(context.Context, *PauseGameReq) (*PauseGameRsp, error)
|
||||||
@@ -690,6 +778,9 @@ type EveningDetectiveServerServer interface {
|
|||||||
GetTeamStory(context.Context, *GetTeamStoryReq) (*GetTeamStoryRsp, error)
|
GetTeamStory(context.Context, *GetTeamStoryReq) (*GetTeamStoryRsp, error)
|
||||||
AddTeamAction(context.Context, *AddTeamActionReq) (*AddTeamActionRsp, error)
|
AddTeamAction(context.Context, *AddTeamActionReq) (*AddTeamActionRsp, error)
|
||||||
DeleteLastTeamAction(context.Context, *DeleteLastTeamActionReq) (*DeleteLastTeamActionRsp, error)
|
DeleteLastTeamAction(context.Context, *DeleteLastTeamActionReq) (*DeleteLastTeamActionRsp, error)
|
||||||
|
GetTeamAnswers(context.Context, *GetTeamAnswersReq) (*GetTeamAnswersRsp, error)
|
||||||
|
SubmitTeamAnswers(context.Context, *SubmitTeamAnswersReq) (*SubmitTeamAnswersRsp, error)
|
||||||
|
SetTeamAnswerScore(context.Context, *SetTeamAnswerScoreReq) (*SetTeamAnswerScoreRsp, error)
|
||||||
mustEmbedUnimplementedEveningDetectiveServerServer()
|
mustEmbedUnimplementedEveningDetectiveServerServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,6 +881,15 @@ func (UnimplementedEveningDetectiveServerServer) UpdateScenarioPlace(context.Con
|
|||||||
func (UnimplementedEveningDetectiveServerServer) DeleteScenarioPlace(context.Context, *DeleteScenarioPlaceReq) (*DeleteScenarioPlaceRsp, error) {
|
func (UnimplementedEveningDetectiveServerServer) DeleteScenarioPlace(context.Context, *DeleteScenarioPlaceReq) (*DeleteScenarioPlaceRsp, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method DeleteScenarioPlace not implemented")
|
return nil, status.Error(codes.Unimplemented, "method DeleteScenarioPlace not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) AddScenarioQuestion(context.Context, *AddScenarioQuestionReq) (*AddScenarioQuestionRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method AddScenarioQuestion not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) UpdateScenarioQuestion(context.Context, *UpdateScenarioQuestionReq) (*UpdateScenarioQuestionRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method UpdateScenarioQuestion not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) DeleteScenarioQuestion(context.Context, *DeleteScenarioQuestionReq) (*DeleteScenarioQuestionRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method DeleteScenarioQuestion not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedEveningDetectiveServerServer) UpdateScenarioIntro(context.Context, *UpdateScenarioIntroReq) (*UpdateScenarioIntroRsp, error) {
|
func (UnimplementedEveningDetectiveServerServer) UpdateScenarioIntro(context.Context, *UpdateScenarioIntroReq) (*UpdateScenarioIntroRsp, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method UpdateScenarioIntro not implemented")
|
return nil, status.Error(codes.Unimplemented, "method UpdateScenarioIntro not implemented")
|
||||||
}
|
}
|
||||||
@@ -808,6 +908,9 @@ func (UnimplementedEveningDetectiveServerServer) GetGames(context.Context, *GetG
|
|||||||
func (UnimplementedEveningDetectiveServerServer) GetGame(context.Context, *GetGameReq) (*GetGameRsp, error) {
|
func (UnimplementedEveningDetectiveServerServer) GetGame(context.Context, *GetGameReq) (*GetGameRsp, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method GetGame not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetGame not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) GetGameAnswers(context.Context, *GetGameAnswersReq) (*GetGameAnswersRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetGameAnswers not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedEveningDetectiveServerServer) UpdateGame(context.Context, *UpdateGameReq) (*UpdateGameRsp, error) {
|
func (UnimplementedEveningDetectiveServerServer) UpdateGame(context.Context, *UpdateGameReq) (*UpdateGameRsp, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method UpdateGame not implemented")
|
return nil, status.Error(codes.Unimplemented, "method UpdateGame not implemented")
|
||||||
}
|
}
|
||||||
@@ -850,6 +953,15 @@ func (UnimplementedEveningDetectiveServerServer) AddTeamAction(context.Context,
|
|||||||
func (UnimplementedEveningDetectiveServerServer) DeleteLastTeamAction(context.Context, *DeleteLastTeamActionReq) (*DeleteLastTeamActionRsp, error) {
|
func (UnimplementedEveningDetectiveServerServer) DeleteLastTeamAction(context.Context, *DeleteLastTeamActionReq) (*DeleteLastTeamActionRsp, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method DeleteLastTeamAction not implemented")
|
return nil, status.Error(codes.Unimplemented, "method DeleteLastTeamAction not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) GetTeamAnswers(context.Context, *GetTeamAnswersReq) (*GetTeamAnswersRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetTeamAnswers not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) SubmitTeamAnswers(context.Context, *SubmitTeamAnswersReq) (*SubmitTeamAnswersRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method SubmitTeamAnswers not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedEveningDetectiveServerServer) SetTeamAnswerScore(context.Context, *SetTeamAnswerScoreReq) (*SetTeamAnswerScoreRsp, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method SetTeamAnswerScore not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
|
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
|
||||||
}
|
}
|
||||||
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
|
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
|
||||||
@@ -1412,6 +1524,60 @@ func _EveningDetectiveServer_DeleteScenarioPlace_Handler(srv interface{}, ctx co
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_AddScenarioQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(AddScenarioQuestionReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).AddScenarioQuestion(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_AddScenarioQuestion_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).AddScenarioQuestion(ctx, req.(*AddScenarioQuestionReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_UpdateScenarioQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateScenarioQuestionReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).UpdateScenarioQuestion(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_UpdateScenarioQuestion_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).UpdateScenarioQuestion(ctx, req.(*UpdateScenarioQuestionReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_DeleteScenarioQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DeleteScenarioQuestionReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).DeleteScenarioQuestion(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_DeleteScenarioQuestion_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).DeleteScenarioQuestion(ctx, req.(*DeleteScenarioQuestionReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _EveningDetectiveServer_UpdateScenarioIntro_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _EveningDetectiveServer_UpdateScenarioIntro_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(UpdateScenarioIntroReq)
|
in := new(UpdateScenarioIntroReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -1520,6 +1686,24 @@ func _EveningDetectiveServer_GetGame_Handler(srv interface{}, ctx context.Contex
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_GetGameAnswers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetGameAnswersReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).GetGameAnswers(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_GetGameAnswers_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).GetGameAnswers(ctx, req.(*GetGameAnswersReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _EveningDetectiveServer_UpdateGame_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _EveningDetectiveServer_UpdateGame_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(UpdateGameReq)
|
in := new(UpdateGameReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -1772,6 +1956,60 @@ func _EveningDetectiveServer_DeleteLastTeamAction_Handler(srv interface{}, ctx c
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_GetTeamAnswers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetTeamAnswersReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).GetTeamAnswers(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_GetTeamAnswers_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).GetTeamAnswers(ctx, req.(*GetTeamAnswersReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_SubmitTeamAnswers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SubmitTeamAnswersReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).SubmitTeamAnswers(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_SubmitTeamAnswers_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).SubmitTeamAnswers(ctx, req.(*SubmitTeamAnswersReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _EveningDetectiveServer_SetTeamAnswerScore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SetTeamAnswerScoreReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(EveningDetectiveServerServer).SetTeamAnswerScore(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: EveningDetectiveServer_SetTeamAnswerScore_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(EveningDetectiveServerServer).SetTeamAnswerScore(ctx, req.(*SetTeamAnswerScoreReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
|
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -1899,6 +2137,18 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "DeleteScenarioPlace",
|
MethodName: "DeleteScenarioPlace",
|
||||||
Handler: _EveningDetectiveServer_DeleteScenarioPlace_Handler,
|
Handler: _EveningDetectiveServer_DeleteScenarioPlace_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "AddScenarioQuestion",
|
||||||
|
Handler: _EveningDetectiveServer_AddScenarioQuestion_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateScenarioQuestion",
|
||||||
|
Handler: _EveningDetectiveServer_UpdateScenarioQuestion_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "DeleteScenarioQuestion",
|
||||||
|
Handler: _EveningDetectiveServer_DeleteScenarioQuestion_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "UpdateScenarioIntro",
|
MethodName: "UpdateScenarioIntro",
|
||||||
Handler: _EveningDetectiveServer_UpdateScenarioIntro_Handler,
|
Handler: _EveningDetectiveServer_UpdateScenarioIntro_Handler,
|
||||||
@@ -1923,6 +2173,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetGame",
|
MethodName: "GetGame",
|
||||||
Handler: _EveningDetectiveServer_GetGame_Handler,
|
Handler: _EveningDetectiveServer_GetGame_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetGameAnswers",
|
||||||
|
Handler: _EveningDetectiveServer_GetGameAnswers_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "UpdateGame",
|
MethodName: "UpdateGame",
|
||||||
Handler: _EveningDetectiveServer_UpdateGame_Handler,
|
Handler: _EveningDetectiveServer_UpdateGame_Handler,
|
||||||
@@ -1979,6 +2233,18 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "DeleteLastTeamAction",
|
MethodName: "DeleteLastTeamAction",
|
||||||
Handler: _EveningDetectiveServer_DeleteLastTeamAction_Handler,
|
Handler: _EveningDetectiveServer_DeleteLastTeamAction_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetTeamAnswers",
|
||||||
|
Handler: _EveningDetectiveServer_GetTeamAnswers_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SubmitTeamAnswers",
|
||||||
|
Handler: _EveningDetectiveServer_SubmitTeamAnswers_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SetTeamAnswerScore",
|
||||||
|
Handler: _EveningDetectiveServer_SetTeamAnswerScore_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "main.proto",
|
Metadata: "main.proto",
|
||||||
|
|||||||
Reference in New Issue
Block a user