diff --git a/proto/main.proto b/proto/main.proto index 10f37e7..944aa3c 100644 --- a/proto/main.proto +++ b/proto/main.proto @@ -365,6 +365,17 @@ service EveningDetectiveServer { }; } + rpc UpdateScenarioIntro(UpdateScenarioIntroReq) returns (UpdateScenarioIntroRsp) { + option (google.api.http) = { + put : "/api/scenarios/{id}/introduction" + body: "*" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags : "Сценарии"; + summary: "Обновить введение сценария"; + }; + } + rpc DownloadScenarioArchive(DownloadScenarioArchiveReq) returns (google.api.HttpBody) { option (google.api.http) = { get: "/api/scenarios/{id}/archive" @@ -776,7 +787,13 @@ message Scenario { } message Story { - repeated Place places = 1; + Introduction introduction = 2; + repeated Place places = 1; +} + +message Introduction { + string text = 1; + string audio = 2; } message Place { @@ -868,6 +885,15 @@ message DeleteScenarioPlaceRsp { string error = 1; } +message UpdateScenarioIntroReq { + int32 id = 1; + Introduction introduction = 2; +} + +message UpdateScenarioIntroRsp { + string error = 1; +} + message DownloadScenarioArchiveReq { int32 id = 1; } diff --git a/src/api/generated/crabs/evening_detective_server/index.ts b/src/api/generated/crabs/evening_detective_server/index.ts index dbdeb2d..a8f134d 100644 --- a/src/api/generated/crabs/evening_detective_server/index.ts +++ b/src/api/generated/crabs/evening_detective_server/index.ts @@ -203,9 +203,15 @@ export type Scenario = { }; export type Story = { + introduction: Introduction | undefined; places: Place[] | undefined; }; +export type Introduction = { + text: string | undefined; + audio: string | undefined; +}; + export type Place = { code: string | undefined; name: string | undefined; @@ -312,6 +318,15 @@ export type DeleteScenarioPlaceRsp = { error: string | undefined; }; +export type UpdateScenarioIntroReq = { + id: number | undefined; + introduction: Introduction | undefined; +}; + +export type UpdateScenarioIntroRsp = { + error: string | undefined; +}; + export type DownloadScenarioArchiveReq = { id: number | undefined; }; @@ -528,6 +543,7 @@ export interface EveningDetectiveServer { AddScenarioPlace(request: AddScenarioPlaceReq): Promise; UpdateScenarioPlace(request: UpdateScenarioPlaceReq): Promise; DeleteScenarioPlace(request: DeleteScenarioPlaceReq): Promise; + UpdateScenarioIntro(request: UpdateScenarioIntroReq): Promise; DownloadScenarioArchive(request: DownloadScenarioArchiveReq): Promise; UploadScenarioArchive(request: googleapi_HttpBody): Promise; AddGame(request: AddGameReq): Promise; @@ -1119,6 +1135,26 @@ export function createEveningDetectiveServerClient( method: "DeleteScenarioPlace", }) as Promise; }, + UpdateScenarioIntro(request) { // eslint-disable-line @typescript-eslint/no-unused-vars + if (!request.id) { + throw new Error("missing required field request.id"); + } + const path = `api/scenarios/${request.id}/introduction`; // eslint-disable-line quotes + const body = JSON.stringify(request); + const queryParams: string[] = []; + let uri = path; + if (queryParams.length > 0) { + uri += `?${queryParams.join("&")}` + } + return handler({ + path: uri, + method: "PUT", + body, + }, { + service: "EveningDetectiveServer", + method: "UpdateScenarioIntro", + }) as Promise; + }, DownloadScenarioArchive(request) { // eslint-disable-line @typescript-eslint/no-unused-vars if (!request.id) { throw new Error("missing required field request.id");