+177
-11
@@ -10,6 +10,8 @@ option go_package = "pkg/proto";
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {};
|
||||
|
||||
service SmmCore {
|
||||
|
||||
// ping
|
||||
rpc Ping(PingReq) returns (PingRsp) {
|
||||
option (google.api.http) = {
|
||||
get: "/ping"
|
||||
@@ -17,15 +19,62 @@ service SmmCore {
|
||||
}
|
||||
|
||||
// users
|
||||
rpc AddUser(CreateUserReq) returns (User) {
|
||||
rpc AddUser(AddUserReq) returns (User) {
|
||||
option (google.api.http) = {
|
||||
post: "/users",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc Login(LoginReq) returns (User) {
|
||||
option (google.api.http) = {
|
||||
post: "/login",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// budgets
|
||||
rpc AddBudget(AddBudgetReq) returns (Budget) {
|
||||
option (google.api.http) = {
|
||||
post: "/budgets",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc UpdateBudget(UpdateBudgetReq) returns (Budget) {
|
||||
option (google.api.http) = {
|
||||
put: "/budgets/{id}",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc GetBudgets(GetBudgetsReq) returns (Budgets) {
|
||||
option (google.api.http) = {
|
||||
get: "/budgets"
|
||||
};
|
||||
}
|
||||
rpc DeleteBudget(DeleteBudgetReq) returns (Budget) {
|
||||
option (google.api.http) = {
|
||||
delete: "/budgets/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// budget users
|
||||
rpc AddUserToBudget(AddUserToBudgetReq) returns (Budget) {
|
||||
option (google.api.http) = {
|
||||
put: "/budgets/{budget_id}/users"
|
||||
};
|
||||
}
|
||||
rpc GetBudgetUsers(GetBudgetUsersReq) returns (Users) {
|
||||
option (google.api.http) = {
|
||||
get: "/budgets/{id}/users"
|
||||
};
|
||||
}
|
||||
rpc RemoveUserFromBudget(RemoveUserFromBudgetReq) returns (Budget) {
|
||||
option (google.api.http) = {
|
||||
delete: "/budgets/{budget_id}/users/{user_id}"
|
||||
};
|
||||
}
|
||||
|
||||
// categories
|
||||
rpc AddCategory(CreateCategoryReq) returns (Category) {
|
||||
rpc AddCategory(AddCategoryReq) returns (Category) {
|
||||
option (google.api.http) = {
|
||||
post: "/categories",
|
||||
body: "*"
|
||||
@@ -36,51 +85,168 @@ service SmmCore {
|
||||
put: "/categories/{id}"
|
||||
};
|
||||
}
|
||||
rpc GetCategories(CategoryFilterReq) returns (Categories) {
|
||||
rpc GetCategories(GetCategoriesReq) returns (Categories) {
|
||||
option (google.api.http) = {
|
||||
get: "/categories"
|
||||
};
|
||||
}
|
||||
rpc DeleteCategories(DeleteCategoriesReq) returns (Category) {
|
||||
option (google.api.http) = {
|
||||
delete: "/categories/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// positions
|
||||
rpc AddPosition(AddPositionReq) returns (Position) {
|
||||
option (google.api.http) = {
|
||||
post: "/positions",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc DeletePosition(DeletePositionReq) returns (Position) {
|
||||
option (google.api.http) = {
|
||||
delete: "/positions/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// stat
|
||||
rpc GetCategoriesStat(GetCategoriesStatReq) returns (CategoriesStat) {
|
||||
option (google.api.http) = {
|
||||
get: "/stat"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message PingReq {}
|
||||
|
||||
message PingRsp {}
|
||||
|
||||
message CreateUserReq {
|
||||
message AddUserReq {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message User {
|
||||
int32 id = 1;
|
||||
string id = 1;
|
||||
string username = 2;
|
||||
}
|
||||
|
||||
message CreateCategoryReq {
|
||||
message LoginReq {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message AddBudgetReq {
|
||||
string name = 1;
|
||||
bool favorite = 2;
|
||||
int32 start_day = 2;
|
||||
int32 monthly_limit = 3;
|
||||
}
|
||||
|
||||
message UpdateCategoryReq {
|
||||
int32 id = 1;
|
||||
message Budget {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 start_day = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message UpdateBudgetReq {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 start_day = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message GetBudgetsReq {}
|
||||
|
||||
message Budgets {
|
||||
repeated Budget budgets = 1;
|
||||
}
|
||||
|
||||
message DeleteBudgetReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message AddUserToBudgetReq {
|
||||
string user_id = 1;
|
||||
string budget_id = 2;
|
||||
}
|
||||
|
||||
message GetBudgetUsersReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message Users {
|
||||
repeated User users = 1;
|
||||
}
|
||||
|
||||
message RemoveUserFromBudgetReq {
|
||||
string user_id = 1;
|
||||
string budget_id = 2;
|
||||
}
|
||||
|
||||
message AddCategoryReq {
|
||||
string name = 1;
|
||||
int32 budget_id = 2;
|
||||
bool favorite = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message Category {
|
||||
int32 id = 1;
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 budget_id = 3;
|
||||
bool favorite = 4;
|
||||
int32 monthly_limit = 5;
|
||||
}
|
||||
|
||||
message CategoryFilterReq {
|
||||
message UpdateCategoryReq {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
bool favorite = 3;
|
||||
int32 monthly_limit = 4;
|
||||
}
|
||||
|
||||
message GetCategoriesReq {
|
||||
bool favorite = 1;
|
||||
int32 budget_id = 2;
|
||||
}
|
||||
|
||||
message Categories {
|
||||
repeated Category categories = 1;
|
||||
}
|
||||
|
||||
message DeleteCategoriesReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message AddPositionReq {
|
||||
string name = 1;
|
||||
int32 price = 2;
|
||||
float amount = 3;
|
||||
int32 category_id = 4;
|
||||
}
|
||||
|
||||
message Position {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
int32 price = 3;
|
||||
float amount = 4;
|
||||
}
|
||||
|
||||
message DeletePositionReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetCategoriesStatReq {
|
||||
repeated int32 ids = 1;
|
||||
}
|
||||
|
||||
message CategoriesStat {
|
||||
repeated CategoriesStat stat = 1;
|
||||
}
|
||||
|
||||
message CategoryStat {
|
||||
string name = 1;
|
||||
int32 monthly_limit = 2;
|
||||
int32 amount = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user