generated from VLADIMIR/template_frontend
add gen proto
This commit is contained in:
@@ -0,0 +1,519 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package crabs.evening_detective_server;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "google/api/httpbody.proto";
|
||||
|
||||
option go_package = "pkg/proto";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
info: {
|
||||
title : "Документация сервиса \"Вечерний детектив\"";
|
||||
version: "v0.1.0";
|
||||
};
|
||||
|
||||
security_definitions: {
|
||||
security: {
|
||||
key : "BearerAuth";
|
||||
value: {
|
||||
type : TYPE_API_KEY;
|
||||
in : IN_HEADER;
|
||||
name : "Authorization";
|
||||
description: "Authentication token, prefixed by Bearer: Bearer <token>";
|
||||
}
|
||||
}
|
||||
}
|
||||
security: {
|
||||
security_requirement: {
|
||||
key : "BearerAuth";
|
||||
value: {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
service EveningDetectiveServer {
|
||||
rpc Ping(PingReq) returns (PingRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/test/ping"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
summary: "Проверить доступность";
|
||||
};
|
||||
}
|
||||
|
||||
rpc Echo(EchoReq) returns (EchoRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/test/echo"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
summary: "Проверить обработку данных";
|
||||
};
|
||||
}
|
||||
|
||||
rpc Signup(SignupReq) returns (SignupRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/signup"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
tags : "Регистрация и вход";
|
||||
summary: "Зарегистрироваться";
|
||||
};
|
||||
}
|
||||
|
||||
rpc RefreshPassword(RefreshPasswordReq) returns (RefreshPasswordRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/refresh-password"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
tags : "Регистрация и вход";
|
||||
summary: "Обновить пароль";
|
||||
};
|
||||
}
|
||||
|
||||
rpc Login(LoginReq) returns (LoginRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/login"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
tags : "Регистрация и вход";
|
||||
summary: "Войти и получить токена доступа";
|
||||
};
|
||||
}
|
||||
|
||||
rpc Refresh(RefreshReq) returns (RefreshRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/refresh"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
security: {
|
||||
security_requirement: {}
|
||||
}
|
||||
tags : "Регистрация и вход";
|
||||
summary: "Обновить токена доступа";
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetUsers(GetUsersReq) returns (GetUsersRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/users"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Пользователи";
|
||||
summary: "Получить всех пользователей";
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetUserById(GetUserByIdReq) returns (GetUserByIdRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/users/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Пользователи";
|
||||
summary: "Получить пользователя по id";
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetMe(GetMeReq) returns (GetMeRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/users/me"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Пользователи";
|
||||
summary: "Получить информацию о себе";
|
||||
};
|
||||
}
|
||||
|
||||
rpc AddUserRole(AddUserRoleReq) returns (AddUserRoleRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/users/{id}/role/add"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Пользователи";
|
||||
summary: "Добавить пользователю роль";
|
||||
};
|
||||
}
|
||||
|
||||
rpc DeleteUserRole(DeleteUserRoleReq) returns (DeleteUserRoleRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/users/{id}/role/delete"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Пользователи";
|
||||
summary: "Забрать у пользователя роль";
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetPermissions(GetPermissionsReq) returns (GetPermissionsRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/ui/permissions"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Доступы";
|
||||
summary: "Получить список доступных элементов интерфейса";
|
||||
};
|
||||
}
|
||||
|
||||
rpc UploadFile(UploadFileReq) returns (UploadFileRsp) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/files/upload"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Файлы";
|
||||
summary: "Загрузить файл";
|
||||
};
|
||||
}
|
||||
|
||||
rpc DownloadFile(DownloadFileReq) returns (google.api.HttpBody) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/files/{filename}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Файлы";
|
||||
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/{id}/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/{id}/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/{id}/places/{code}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
tags : "Точки сценария";
|
||||
summary: "Удалить точку сценария";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message PingReq {}
|
||||
|
||||
message PingRsp {}
|
||||
|
||||
message EchoReq {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message EchoRsp {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message SignupReq {
|
||||
string username = 1;
|
||||
string email = 2;
|
||||
}
|
||||
|
||||
message SignupRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message RefreshPasswordReq {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
message RefreshPasswordRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message LoginReq {
|
||||
string email = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message LoginRsp {
|
||||
string error = 1;
|
||||
string accessToken = 2;
|
||||
string refreshToken = 3;
|
||||
}
|
||||
|
||||
message RefreshReq {
|
||||
string refreshToken = 1;
|
||||
}
|
||||
|
||||
message RefreshRsp {
|
||||
string error = 1;
|
||||
string accessToken = 2;
|
||||
string refreshToken = 3;
|
||||
}
|
||||
|
||||
message GetUsersReq {}
|
||||
|
||||
message GetUsersRsp {
|
||||
string error = 1;
|
||||
repeated User users = 2;
|
||||
}
|
||||
|
||||
message User {
|
||||
int32 id = 1;
|
||||
string username = 2;
|
||||
string email = 3;
|
||||
repeated string roles = 4;
|
||||
bool is_active = 5;
|
||||
google.protobuf.Timestamp created_at = 6;
|
||||
}
|
||||
|
||||
message GetUserByIdReq {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetUserByIdRsp {
|
||||
string error = 1;
|
||||
User user = 2;
|
||||
}
|
||||
|
||||
message GetMeReq {}
|
||||
|
||||
message GetMeRsp {
|
||||
string error = 1;
|
||||
User user = 2;
|
||||
}
|
||||
|
||||
message AddUserRoleReq {
|
||||
int32 id = 1;
|
||||
string role = 2;
|
||||
}
|
||||
|
||||
message AddUserRoleRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message DeleteUserRoleReq {
|
||||
int32 id = 1;
|
||||
string role = 2;
|
||||
}
|
||||
|
||||
message DeleteUserRoleRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message GetPermissionsReq {}
|
||||
|
||||
message GetPermissionsRsp {
|
||||
string error = 1;
|
||||
repeated string permissions = 2;
|
||||
}
|
||||
|
||||
message UploadFileReq {
|
||||
string filename = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
message UploadFileRsp {
|
||||
string error = 1;
|
||||
string filename = 2;
|
||||
}
|
||||
|
||||
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 {
|
||||
int32 id = 1;
|
||||
Place place = 2;
|
||||
}
|
||||
|
||||
message AddScenarioPlaceRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message UpdateScenarioPlaceReq {
|
||||
int32 id = 1;
|
||||
string code = 2;
|
||||
Place place = 3;
|
||||
}
|
||||
|
||||
message UpdateScenarioPlaceRsp {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
message DeleteScenarioPlaceReq {
|
||||
int32 id = 1;
|
||||
string code = 2;
|
||||
}
|
||||
|
||||
message DeleteScenarioPlaceRsp {
|
||||
string error = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user