add scenarios methods

This commit is contained in:
2026-07-13 23:48:20 +07:00
parent 487b1aa436
commit db746f2123
17 changed files with 3620 additions and 118 deletions
+195
View File
@@ -197,6 +197,90 @@ service EveningDetectiveServer {
summary: "Получить файл";
};
}
rpc AddScenario(AddScenarioReq) returns (AddScenarioRsp) {
option (google.api.http) = {
post: "/api/scenario"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Сценарии";
summary: "Создать сценарий";
};
}
rpc GetMyScenarios(GetMyScenariosReq) returns (GetMyScenariosRsp) {
option (google.api.http) = {
get: "/api/my-scenarios"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Сценарии";
summary: "Получить свои сценарии";
};
}
rpc GetScenario(GetScenarioReq) returns (GetScenarioRsp) {
option (google.api.http) = {
get: "/api/scenarios/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Сценарии";
summary: "Получить сценарий по id";
};
}
rpc UpdateScenario(UpdateScenarioReq) returns (UpdateScenarioRsp) {
option (google.api.http) = {
put : "/api/scenarios/{id}"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Сценарии";
summary: "Редактировать сценарий";
};
}
rpc DeleteScenario(DeleteScenarioReq) returns (DeleteScenarioRsp) {
option (google.api.http) = {
delete: "/api/scenarios/{id}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Сценарии";
summary: "Удалить сценарий";
};
}
rpc AddScenarioPlace(AddScenarioPlaceReq) returns (AddScenarioPlaceRsp) {
option (google.api.http) = {
post: "/api/scenarios/places"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Точки сценария";
summary: "Создать точку сценария";
};
}
rpc UpdateScenarioPlace(UpdateScenarioPlaceReq) returns (UpdateScenarioPlaceRsp) {
option (google.api.http) = {
put : "/api/scenarios/places/{code}"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Точки сценария";
summary: "Обновить точку сценария";
};
}
rpc DeleteScenarioPlace(DeleteScenarioPlaceReq) returns (DeleteScenarioPlaceRsp) {
option (google.api.http) = {
delete: "/api/scenarios/places/{code}"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags : "Точки сценария";
summary: "Удалить точку сценария";
};
}
}
message PingReq {}
@@ -319,3 +403,114 @@ message UploadFileRsp {
message DownloadFileReq {
string filename = 1;
}
message AddScenarioReq {
string name = 1;
}
message AddScenarioRsp {
string error = 1;
int32 id = 2;
}
message GetMyScenariosReq {}
message GetMyScenariosRsp {
string error = 1;
repeated Scenario scenarios = 2;
}
message GetScenarioReq {
int32 id = 1;
}
message GetScenarioRsp {
string error = 1;
Scenario scenario = 2;
}
message Scenario {
int32 id = 1;
string name = 2;
optional string description = 3;
optional string image = 4;
Story story = 5;
User author = 6;
google.protobuf.Timestamp updated_at = 7;
google.protobuf.Timestamp created_at = 8;
google.protobuf.Timestamp published_at = 9;
}
message Story {
repeated Place places = 1;
}
message Place {
string code = 1;
string name = 2;
string text = 3;
string image = 4;
bool hidden = 5;
repeated Application applications = 6;
repeated Door doors = 7;
repeated Key keys = 8;
}
message Application {
string name = 1;
string image = 2;
}
message Door {
string code = 1;
string name = 2;
repeated Key keys = 3;
}
message Key {
string name = 1;
}
message UpdateScenarioReq {
int32 id = 1;
string name = 2;
string description = 3;
string image = 4;
}
message UpdateScenarioRsp {
string error = 1;
}
message DeleteScenarioReq {
int32 id = 1;
}
message DeleteScenarioRsp {
string error = 1;
}
message AddScenarioPlaceReq {
Place place = 1;
}
message AddScenarioPlaceRsp {
string error = 1;
}
message UpdateScenarioPlaceReq {
string code = 1;
Place place = 2;
}
message UpdateScenarioPlaceRsp {
string error = 1;
}
message DeleteScenarioPlaceReq {
string code = 1;
}
message DeleteScenarioPlaceRsp {
string error = 1;
}