update api
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Владимир Фёдоров 2024-11-21 02:10:29 +07:00
parent a8b6e9ab9b
commit 66df21c6c9
5 changed files with 3772 additions and 274 deletions

View File

@ -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;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,24 +19,53 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
SmmCore_Ping_FullMethodName = "/crabs.smm_core.SmmCore/Ping"
SmmCore_AddUser_FullMethodName = "/crabs.smm_core.SmmCore/AddUser"
SmmCore_AddCategory_FullMethodName = "/crabs.smm_core.SmmCore/AddCategory"
SmmCore_UpdateCategory_FullMethodName = "/crabs.smm_core.SmmCore/UpdateCategory"
SmmCore_GetCategories_FullMethodName = "/crabs.smm_core.SmmCore/GetCategories"
SmmCore_Ping_FullMethodName = "/crabs.smm_core.SmmCore/Ping"
SmmCore_AddUser_FullMethodName = "/crabs.smm_core.SmmCore/AddUser"
SmmCore_Login_FullMethodName = "/crabs.smm_core.SmmCore/Login"
SmmCore_AddBudget_FullMethodName = "/crabs.smm_core.SmmCore/AddBudget"
SmmCore_UpdateBudget_FullMethodName = "/crabs.smm_core.SmmCore/UpdateBudget"
SmmCore_GetBudgets_FullMethodName = "/crabs.smm_core.SmmCore/GetBudgets"
SmmCore_DeleteBudget_FullMethodName = "/crabs.smm_core.SmmCore/DeleteBudget"
SmmCore_AddUserToBudget_FullMethodName = "/crabs.smm_core.SmmCore/AddUserToBudget"
SmmCore_GetBudgetUsers_FullMethodName = "/crabs.smm_core.SmmCore/GetBudgetUsers"
SmmCore_RemoveUserFromBudget_FullMethodName = "/crabs.smm_core.SmmCore/RemoveUserFromBudget"
SmmCore_AddCategory_FullMethodName = "/crabs.smm_core.SmmCore/AddCategory"
SmmCore_UpdateCategory_FullMethodName = "/crabs.smm_core.SmmCore/UpdateCategory"
SmmCore_GetCategories_FullMethodName = "/crabs.smm_core.SmmCore/GetCategories"
SmmCore_DeleteCategories_FullMethodName = "/crabs.smm_core.SmmCore/DeleteCategories"
SmmCore_AddPosition_FullMethodName = "/crabs.smm_core.SmmCore/AddPosition"
SmmCore_DeletePosition_FullMethodName = "/crabs.smm_core.SmmCore/DeletePosition"
SmmCore_GetCategoriesStat_FullMethodName = "/crabs.smm_core.SmmCore/GetCategoriesStat"
)
// SmmCoreClient is the client API for SmmCore service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SmmCoreClient interface {
// ping
Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error)
// users
AddUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*User, error)
AddUser(ctx context.Context, in *AddUserReq, opts ...grpc.CallOption) (*User, error)
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*User, error)
// budgets
AddBudget(ctx context.Context, in *AddBudgetReq, opts ...grpc.CallOption) (*Budget, error)
UpdateBudget(ctx context.Context, in *UpdateBudgetReq, opts ...grpc.CallOption) (*Budget, error)
GetBudgets(ctx context.Context, in *GetBudgetsReq, opts ...grpc.CallOption) (*Budgets, error)
DeleteBudget(ctx context.Context, in *DeleteBudgetReq, opts ...grpc.CallOption) (*Budget, error)
// budget users
AddUserToBudget(ctx context.Context, in *AddUserToBudgetReq, opts ...grpc.CallOption) (*Budget, error)
GetBudgetUsers(ctx context.Context, in *GetBudgetUsersReq, opts ...grpc.CallOption) (*Users, error)
RemoveUserFromBudget(ctx context.Context, in *RemoveUserFromBudgetReq, opts ...grpc.CallOption) (*Budget, error)
// categories
AddCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*Category, error)
AddCategory(ctx context.Context, in *AddCategoryReq, opts ...grpc.CallOption) (*Category, error)
UpdateCategory(ctx context.Context, in *UpdateCategoryReq, opts ...grpc.CallOption) (*Category, error)
GetCategories(ctx context.Context, in *CategoryFilterReq, opts ...grpc.CallOption) (*Categories, error)
GetCategories(ctx context.Context, in *GetCategoriesReq, opts ...grpc.CallOption) (*Categories, error)
DeleteCategories(ctx context.Context, in *DeleteCategoriesReq, opts ...grpc.CallOption) (*Category, error)
// positions
AddPosition(ctx context.Context, in *AddPositionReq, opts ...grpc.CallOption) (*Position, error)
DeletePosition(ctx context.Context, in *DeletePositionReq, opts ...grpc.CallOption) (*Position, error)
// stat
GetCategoriesStat(ctx context.Context, in *GetCategoriesStatReq, opts ...grpc.CallOption) (*CategoriesStat, error)
}
type smmCoreClient struct {
@ -57,7 +86,7 @@ func (c *smmCoreClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.Call
return out, nil
}
func (c *smmCoreClient) AddUser(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*User, error) {
func (c *smmCoreClient) AddUser(ctx context.Context, in *AddUserReq, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
err := c.cc.Invoke(ctx, SmmCore_AddUser_FullMethodName, in, out, cOpts...)
@ -67,7 +96,87 @@ func (c *smmCoreClient) AddUser(ctx context.Context, in *CreateUserReq, opts ...
return out, nil
}
func (c *smmCoreClient) AddCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*Category, error) {
func (c *smmCoreClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
err := c.cc.Invoke(ctx, SmmCore_Login_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) AddBudget(ctx context.Context, in *AddBudgetReq, opts ...grpc.CallOption) (*Budget, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budget)
err := c.cc.Invoke(ctx, SmmCore_AddBudget_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) UpdateBudget(ctx context.Context, in *UpdateBudgetReq, opts ...grpc.CallOption) (*Budget, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budget)
err := c.cc.Invoke(ctx, SmmCore_UpdateBudget_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) GetBudgets(ctx context.Context, in *GetBudgetsReq, opts ...grpc.CallOption) (*Budgets, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budgets)
err := c.cc.Invoke(ctx, SmmCore_GetBudgets_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) DeleteBudget(ctx context.Context, in *DeleteBudgetReq, opts ...grpc.CallOption) (*Budget, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budget)
err := c.cc.Invoke(ctx, SmmCore_DeleteBudget_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) AddUserToBudget(ctx context.Context, in *AddUserToBudgetReq, opts ...grpc.CallOption) (*Budget, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budget)
err := c.cc.Invoke(ctx, SmmCore_AddUserToBudget_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) GetBudgetUsers(ctx context.Context, in *GetBudgetUsersReq, opts ...grpc.CallOption) (*Users, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Users)
err := c.cc.Invoke(ctx, SmmCore_GetBudgetUsers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) RemoveUserFromBudget(ctx context.Context, in *RemoveUserFromBudgetReq, opts ...grpc.CallOption) (*Budget, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Budget)
err := c.cc.Invoke(ctx, SmmCore_RemoveUserFromBudget_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) AddCategory(ctx context.Context, in *AddCategoryReq, opts ...grpc.CallOption) (*Category, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Category)
err := c.cc.Invoke(ctx, SmmCore_AddCategory_FullMethodName, in, out, cOpts...)
@ -87,7 +196,7 @@ func (c *smmCoreClient) UpdateCategory(ctx context.Context, in *UpdateCategoryRe
return out, nil
}
func (c *smmCoreClient) GetCategories(ctx context.Context, in *CategoryFilterReq, opts ...grpc.CallOption) (*Categories, error) {
func (c *smmCoreClient) GetCategories(ctx context.Context, in *GetCategoriesReq, opts ...grpc.CallOption) (*Categories, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Categories)
err := c.cc.Invoke(ctx, SmmCore_GetCategories_FullMethodName, in, out, cOpts...)
@ -97,17 +206,74 @@ func (c *smmCoreClient) GetCategories(ctx context.Context, in *CategoryFilterReq
return out, nil
}
func (c *smmCoreClient) DeleteCategories(ctx context.Context, in *DeleteCategoriesReq, opts ...grpc.CallOption) (*Category, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Category)
err := c.cc.Invoke(ctx, SmmCore_DeleteCategories_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) AddPosition(ctx context.Context, in *AddPositionReq, opts ...grpc.CallOption) (*Position, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Position)
err := c.cc.Invoke(ctx, SmmCore_AddPosition_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) DeletePosition(ctx context.Context, in *DeletePositionReq, opts ...grpc.CallOption) (*Position, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Position)
err := c.cc.Invoke(ctx, SmmCore_DeletePosition_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *smmCoreClient) GetCategoriesStat(ctx context.Context, in *GetCategoriesStatReq, opts ...grpc.CallOption) (*CategoriesStat, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CategoriesStat)
err := c.cc.Invoke(ctx, SmmCore_GetCategoriesStat_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SmmCoreServer is the server API for SmmCore service.
// All implementations must embed UnimplementedSmmCoreServer
// for forward compatibility.
type SmmCoreServer interface {
// ping
Ping(context.Context, *PingReq) (*PingRsp, error)
// users
AddUser(context.Context, *CreateUserReq) (*User, error)
AddUser(context.Context, *AddUserReq) (*User, error)
Login(context.Context, *LoginReq) (*User, error)
// budgets
AddBudget(context.Context, *AddBudgetReq) (*Budget, error)
UpdateBudget(context.Context, *UpdateBudgetReq) (*Budget, error)
GetBudgets(context.Context, *GetBudgetsReq) (*Budgets, error)
DeleteBudget(context.Context, *DeleteBudgetReq) (*Budget, error)
// budget users
AddUserToBudget(context.Context, *AddUserToBudgetReq) (*Budget, error)
GetBudgetUsers(context.Context, *GetBudgetUsersReq) (*Users, error)
RemoveUserFromBudget(context.Context, *RemoveUserFromBudgetReq) (*Budget, error)
// categories
AddCategory(context.Context, *CreateCategoryReq) (*Category, error)
AddCategory(context.Context, *AddCategoryReq) (*Category, error)
UpdateCategory(context.Context, *UpdateCategoryReq) (*Category, error)
GetCategories(context.Context, *CategoryFilterReq) (*Categories, error)
GetCategories(context.Context, *GetCategoriesReq) (*Categories, error)
DeleteCategories(context.Context, *DeleteCategoriesReq) (*Category, error)
// positions
AddPosition(context.Context, *AddPositionReq) (*Position, error)
DeletePosition(context.Context, *DeletePositionReq) (*Position, error)
// stat
GetCategoriesStat(context.Context, *GetCategoriesStatReq) (*CategoriesStat, error)
mustEmbedUnimplementedSmmCoreServer()
}
@ -121,18 +287,54 @@ type UnimplementedSmmCoreServer struct{}
func (UnimplementedSmmCoreServer) Ping(context.Context, *PingReq) (*PingRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedSmmCoreServer) AddUser(context.Context, *CreateUserReq) (*User, error) {
func (UnimplementedSmmCoreServer) AddUser(context.Context, *AddUserReq) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddUser not implemented")
}
func (UnimplementedSmmCoreServer) AddCategory(context.Context, *CreateCategoryReq) (*Category, error) {
func (UnimplementedSmmCoreServer) Login(context.Context, *LoginReq) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedSmmCoreServer) AddBudget(context.Context, *AddBudgetReq) (*Budget, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddBudget not implemented")
}
func (UnimplementedSmmCoreServer) UpdateBudget(context.Context, *UpdateBudgetReq) (*Budget, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBudget not implemented")
}
func (UnimplementedSmmCoreServer) GetBudgets(context.Context, *GetBudgetsReq) (*Budgets, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBudgets not implemented")
}
func (UnimplementedSmmCoreServer) DeleteBudget(context.Context, *DeleteBudgetReq) (*Budget, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteBudget not implemented")
}
func (UnimplementedSmmCoreServer) AddUserToBudget(context.Context, *AddUserToBudgetReq) (*Budget, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddUserToBudget not implemented")
}
func (UnimplementedSmmCoreServer) GetBudgetUsers(context.Context, *GetBudgetUsersReq) (*Users, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBudgetUsers not implemented")
}
func (UnimplementedSmmCoreServer) RemoveUserFromBudget(context.Context, *RemoveUserFromBudgetReq) (*Budget, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveUserFromBudget not implemented")
}
func (UnimplementedSmmCoreServer) AddCategory(context.Context, *AddCategoryReq) (*Category, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddCategory not implemented")
}
func (UnimplementedSmmCoreServer) UpdateCategory(context.Context, *UpdateCategoryReq) (*Category, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateCategory not implemented")
}
func (UnimplementedSmmCoreServer) GetCategories(context.Context, *CategoryFilterReq) (*Categories, error) {
func (UnimplementedSmmCoreServer) GetCategories(context.Context, *GetCategoriesReq) (*Categories, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCategories not implemented")
}
func (UnimplementedSmmCoreServer) DeleteCategories(context.Context, *DeleteCategoriesReq) (*Category, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteCategories not implemented")
}
func (UnimplementedSmmCoreServer) AddPosition(context.Context, *AddPositionReq) (*Position, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddPosition not implemented")
}
func (UnimplementedSmmCoreServer) DeletePosition(context.Context, *DeletePositionReq) (*Position, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeletePosition not implemented")
}
func (UnimplementedSmmCoreServer) GetCategoriesStat(context.Context, *GetCategoriesStatReq) (*CategoriesStat, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCategoriesStat not implemented")
}
func (UnimplementedSmmCoreServer) mustEmbedUnimplementedSmmCoreServer() {}
func (UnimplementedSmmCoreServer) testEmbeddedByValue() {}
@ -173,7 +375,7 @@ func _SmmCore_Ping_Handler(srv interface{}, ctx context.Context, dec func(interf
}
func _SmmCore_AddUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserReq)
in := new(AddUserReq)
if err := dec(in); err != nil {
return nil, err
}
@ -185,13 +387,157 @@ func _SmmCore_AddUser_Handler(srv interface{}, ctx context.Context, dec func(int
FullMethod: SmmCore_AddUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).AddUser(ctx, req.(*CreateUserReq))
return srv.(SmmCoreServer).AddUser(ctx, req.(*AddUserReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_Login_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).Login(ctx, req.(*LoginReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_AddBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddBudgetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).AddBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_AddBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).AddBudget(ctx, req.(*AddBudgetReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_UpdateBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBudgetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).UpdateBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_UpdateBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).UpdateBudget(ctx, req.(*UpdateBudgetReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_GetBudgets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBudgetsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).GetBudgets(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_GetBudgets_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).GetBudgets(ctx, req.(*GetBudgetsReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_DeleteBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteBudgetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).DeleteBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_DeleteBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).DeleteBudget(ctx, req.(*DeleteBudgetReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_AddUserToBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddUserToBudgetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).AddUserToBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_AddUserToBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).AddUserToBudget(ctx, req.(*AddUserToBudgetReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_GetBudgetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBudgetUsersReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).GetBudgetUsers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_GetBudgetUsers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).GetBudgetUsers(ctx, req.(*GetBudgetUsersReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_RemoveUserFromBudget_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RemoveUserFromBudgetReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).RemoveUserFromBudget(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_RemoveUserFromBudget_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).RemoveUserFromBudget(ctx, req.(*RemoveUserFromBudgetReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_AddCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateCategoryReq)
in := new(AddCategoryReq)
if err := dec(in); err != nil {
return nil, err
}
@ -203,7 +549,7 @@ func _SmmCore_AddCategory_Handler(srv interface{}, ctx context.Context, dec func
FullMethod: SmmCore_AddCategory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).AddCategory(ctx, req.(*CreateCategoryReq))
return srv.(SmmCoreServer).AddCategory(ctx, req.(*AddCategoryReq))
}
return interceptor(ctx, in, info, handler)
}
@ -227,7 +573,7 @@ func _SmmCore_UpdateCategory_Handler(srv interface{}, ctx context.Context, dec f
}
func _SmmCore_GetCategories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryFilterReq)
in := new(GetCategoriesReq)
if err := dec(in); err != nil {
return nil, err
}
@ -239,7 +585,79 @@ func _SmmCore_GetCategories_Handler(srv interface{}, ctx context.Context, dec fu
FullMethod: SmmCore_GetCategories_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).GetCategories(ctx, req.(*CategoryFilterReq))
return srv.(SmmCoreServer).GetCategories(ctx, req.(*GetCategoriesReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_DeleteCategories_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteCategoriesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).DeleteCategories(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_DeleteCategories_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).DeleteCategories(ctx, req.(*DeleteCategoriesReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_AddPosition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddPositionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).AddPosition(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_AddPosition_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).AddPosition(ctx, req.(*AddPositionReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_DeletePosition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeletePositionReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).DeletePosition(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_DeletePosition_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).DeletePosition(ctx, req.(*DeletePositionReq))
}
return interceptor(ctx, in, info, handler)
}
func _SmmCore_GetCategoriesStat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCategoriesStatReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SmmCoreServer).GetCategoriesStat(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SmmCore_GetCategoriesStat_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SmmCoreServer).GetCategoriesStat(ctx, req.(*GetCategoriesStatReq))
}
return interceptor(ctx, in, info, handler)
}
@ -259,6 +677,38 @@ var SmmCore_ServiceDesc = grpc.ServiceDesc{
MethodName: "AddUser",
Handler: _SmmCore_AddUser_Handler,
},
{
MethodName: "Login",
Handler: _SmmCore_Login_Handler,
},
{
MethodName: "AddBudget",
Handler: _SmmCore_AddBudget_Handler,
},
{
MethodName: "UpdateBudget",
Handler: _SmmCore_UpdateBudget_Handler,
},
{
MethodName: "GetBudgets",
Handler: _SmmCore_GetBudgets_Handler,
},
{
MethodName: "DeleteBudget",
Handler: _SmmCore_DeleteBudget_Handler,
},
{
MethodName: "AddUserToBudget",
Handler: _SmmCore_AddUserToBudget_Handler,
},
{
MethodName: "GetBudgetUsers",
Handler: _SmmCore_GetBudgetUsers_Handler,
},
{
MethodName: "RemoveUserFromBudget",
Handler: _SmmCore_RemoveUserFromBudget_Handler,
},
{
MethodName: "AddCategory",
Handler: _SmmCore_AddCategory_Handler,
@ -271,6 +721,22 @@ var SmmCore_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetCategories",
Handler: _SmmCore_GetCategories_Handler,
},
{
MethodName: "DeleteCategories",
Handler: _SmmCore_DeleteCategories_Handler,
},
{
MethodName: "AddPosition",
Handler: _SmmCore_AddPosition_Handler,
},
{
MethodName: "DeletePosition",
Handler: _SmmCore_DeletePosition_Handler,
},
{
MethodName: "GetCategoriesStat",
Handler: _SmmCore_GetCategoriesStat_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "smm_core.proto",

View File

@ -16,6 +16,228 @@
"application/json"
],
"paths": {
"/budgets": {
"get": {
"operationId": "SmmCore_GetBudgets",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudgets"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"SmmCore"
]
},
"post": {
"summary": "budgets",
"operationId": "SmmCore_AddBudget",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudget"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smm_coreAddBudgetReq"
}
}
],
"tags": [
"SmmCore"
]
}
},
"/budgets/{budgetId}/users": {
"put": {
"summary": "budget users",
"operationId": "SmmCore_AddUserToBudget",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudget"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "budgetId",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "userId",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"SmmCore"
]
}
},
"/budgets/{budgetId}/users/{userId}": {
"delete": {
"operationId": "SmmCore_RemoveUserFromBudget",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudget"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "budgetId",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "userId",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"SmmCore"
]
}
},
"/budgets/{id}": {
"delete": {
"operationId": "SmmCore_DeleteBudget",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudget"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"SmmCore"
]
},
"put": {
"operationId": "SmmCore_UpdateBudget",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreBudget"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SmmCoreUpdateBudgetBody"
}
}
],
"tags": [
"SmmCore"
]
}
},
"/budgets/{id}/users": {
"get": {
"operationId": "SmmCore_GetBudgetUsers",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreUsers"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"SmmCore"
]
}
},
"/categories": {
"get": {
"operationId": "SmmCore_GetCategories",
@ -39,6 +261,13 @@
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "budgetId",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"tags": [
@ -68,7 +297,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smm_coreCreateCategoryReq"
"$ref": "#/definitions/smm_coreAddCategoryReq"
}
}
],
@ -78,6 +307,34 @@
}
},
"/categories/{id}": {
"delete": {
"operationId": "SmmCore_DeleteCategories",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreCategory"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"SmmCore"
]
},
"put": {
"operationId": "SmmCore_UpdateCategory",
"responses": {
@ -99,8 +356,7 @@
"name": "id",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
"type": "string"
},
{
"name": "name",
@ -127,8 +383,41 @@
]
}
},
"/login": {
"post": {
"operationId": "SmmCore_Login",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreUser"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smm_coreLoginReq"
}
}
],
"tags": [
"SmmCore"
]
}
},
"/ping": {
"get": {
"summary": "ping",
"operationId": "SmmCore_Ping",
"responses": {
"200": {
@ -149,6 +438,105 @@
]
}
},
"/positions": {
"post": {
"summary": "positions",
"operationId": "SmmCore_AddPosition",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_corePosition"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smm_coreAddPositionReq"
}
}
],
"tags": [
"SmmCore"
]
}
},
"/positions/{id}": {
"delete": {
"operationId": "SmmCore_DeletePosition",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_corePosition"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"SmmCore"
]
}
},
"/stat": {
"get": {
"summary": "stat",
"operationId": "SmmCore_GetCategoriesStat",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/smm_coreCategoriesStat"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "ids",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"collectionFormat": "multi"
}
],
"tags": [
"SmmCore"
]
}
},
"/users": {
"post": {
"summary": "users",
@ -173,7 +561,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/smm_coreCreateUserReq"
"$ref": "#/definitions/smm_coreAddUserReq"
}
}
],
@ -184,6 +572,22 @@
}
},
"definitions": {
"SmmCoreUpdateBudgetBody": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"startDay": {
"type": "integer",
"format": "int32"
},
"monthlyLimit": {
"type": "integer",
"format": "int32"
}
}
},
"protobufAny": {
"type": "object",
"properties": {
@ -212,6 +616,103 @@
}
}
},
"smm_coreAddBudgetReq": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"startDay": {
"type": "integer",
"format": "int32"
},
"monthlyLimit": {
"type": "integer",
"format": "int32"
}
}
},
"smm_coreAddCategoryReq": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"budgetId": {
"type": "integer",
"format": "int32"
},
"favorite": {
"type": "boolean"
},
"monthlyLimit": {
"type": "integer",
"format": "int32"
}
}
},
"smm_coreAddPositionReq": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"price": {
"type": "integer",
"format": "int32"
},
"amount": {
"type": "number",
"format": "float"
},
"categoryId": {
"type": "integer",
"format": "int32"
}
}
},
"smm_coreAddUserReq": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"smm_coreBudget": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"startDay": {
"type": "integer",
"format": "int32"
},
"monthlyLimit": {
"type": "integer",
"format": "int32"
}
}
},
"smm_coreBudgets": {
"type": "object",
"properties": {
"budgets": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/smm_coreBudget"
}
}
}
},
"smm_coreCategories": {
"type": "object",
"properties": {
@ -224,16 +725,31 @@
}
}
},
"smm_coreCategoriesStat": {
"type": "object",
"properties": {
"stat": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/smm_coreCategoriesStat"
}
}
}
},
"smm_coreCategory": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
"type": "string"
},
"name": {
"type": "string"
},
"budgetId": {
"type": "integer",
"format": "int32"
},
"favorite": {
"type": "boolean"
},
@ -243,22 +759,7 @@
}
}
},
"smm_coreCreateCategoryReq": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"favorite": {
"type": "boolean"
},
"monthlyLimit": {
"type": "integer",
"format": "int32"
}
}
},
"smm_coreCreateUserReq": {
"smm_coreLoginReq": {
"type": "object",
"properties": {
"username": {
@ -272,17 +773,47 @@
"smm_corePingRsp": {
"type": "object"
},
"smm_corePosition": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"price": {
"type": "integer",
"format": "int32"
},
"amount": {
"type": "number",
"format": "float"
}
}
},
"smm_coreUser": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
"type": "string"
},
"username": {
"type": "string"
}
}
},
"smm_coreUsers": {
"type": "object",
"properties": {
"users": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/smm_coreUser"
}
}
}
}
}
}