add roles routes

This commit is contained in:
2026-07-06 23:32:38 +07:00
parent 728fcc6fda
commit 82ffda5c0a
9 changed files with 1029 additions and 39 deletions
+114
View File
@@ -26,7 +26,10 @@ const (
EveningDetectiveServer_Login_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Login"
EveningDetectiveServer_Refresh_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Refresh"
EveningDetectiveServer_GetUsers_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetUsers"
EveningDetectiveServer_GetUserById_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetUserById"
EveningDetectiveServer_GetMe_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetMe"
EveningDetectiveServer_AddUserRole_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddUserRole"
EveningDetectiveServer_DeleteUserRole_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteUserRole"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
@@ -40,7 +43,10 @@ type EveningDetectiveServerClient interface {
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRsp, error)
Refresh(ctx context.Context, in *RefreshReq, opts ...grpc.CallOption) (*RefreshRsp, error)
GetUsers(ctx context.Context, in *GetUsersReq, opts ...grpc.CallOption) (*GetUsersRsp, error)
GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdRsp, error)
GetMe(ctx context.Context, in *GetMeReq, opts ...grpc.CallOption) (*GetMeRsp, error)
AddUserRole(ctx context.Context, in *AddUserRoleReq, opts ...grpc.CallOption) (*AddUserRoleRsp, error)
DeleteUserRole(ctx context.Context, in *DeleteUserRoleReq, opts ...grpc.CallOption) (*DeleteUserRoleRsp, error)
}
type eveningDetectiveServerClient struct {
@@ -121,6 +127,16 @@ func (c *eveningDetectiveServerClient) GetUsers(ctx context.Context, in *GetUser
return out, nil
}
func (c *eveningDetectiveServerClient) GetUserById(ctx context.Context, in *GetUserByIdReq, opts ...grpc.CallOption) (*GetUserByIdRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetUserByIdRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_GetUserById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveServerClient) GetMe(ctx context.Context, in *GetMeReq, opts ...grpc.CallOption) (*GetMeRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetMeRsp)
@@ -131,6 +147,26 @@ func (c *eveningDetectiveServerClient) GetMe(ctx context.Context, in *GetMeReq,
return out, nil
}
func (c *eveningDetectiveServerClient) AddUserRole(ctx context.Context, in *AddUserRoleReq, opts ...grpc.CallOption) (*AddUserRoleRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddUserRoleRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_AddUserRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveServerClient) DeleteUserRole(ctx context.Context, in *DeleteUserRoleReq, opts ...grpc.CallOption) (*DeleteUserRoleRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteUserRoleRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_DeleteUserRole_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
// All implementations must embed UnimplementedEveningDetectiveServerServer
// for forward compatibility.
@@ -142,7 +178,10 @@ type EveningDetectiveServerServer interface {
Login(context.Context, *LoginReq) (*LoginRsp, error)
Refresh(context.Context, *RefreshReq) (*RefreshRsp, error)
GetUsers(context.Context, *GetUsersReq) (*GetUsersRsp, error)
GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdRsp, error)
GetMe(context.Context, *GetMeReq) (*GetMeRsp, error)
AddUserRole(context.Context, *AddUserRoleReq) (*AddUserRoleRsp, error)
DeleteUserRole(context.Context, *DeleteUserRoleReq) (*DeleteUserRoleRsp, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
@@ -174,9 +213,18 @@ func (UnimplementedEveningDetectiveServerServer) Refresh(context.Context, *Refre
func (UnimplementedEveningDetectiveServerServer) GetUsers(context.Context, *GetUsersReq) (*GetUsersRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetUsers not implemented")
}
func (UnimplementedEveningDetectiveServerServer) GetUserById(context.Context, *GetUserByIdReq) (*GetUserByIdRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetUserById not implemented")
}
func (UnimplementedEveningDetectiveServerServer) GetMe(context.Context, *GetMeReq) (*GetMeRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetMe not implemented")
}
func (UnimplementedEveningDetectiveServerServer) AddUserRole(context.Context, *AddUserRoleReq) (*AddUserRoleRsp, error) {
return nil, status.Error(codes.Unimplemented, "method AddUserRole not implemented")
}
func (UnimplementedEveningDetectiveServerServer) DeleteUserRole(context.Context, *DeleteUserRoleReq) (*DeleteUserRoleRsp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteUserRole not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
@@ -325,6 +373,24 @@ func _EveningDetectiveServer_GetUsers_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserByIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).GetUserById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_GetUserById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).GetUserById(ctx, req.(*GetUserByIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_GetMe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMeReq)
if err := dec(in); err != nil {
@@ -343,6 +409,42 @@ func _EveningDetectiveServer_GetMe_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_AddUserRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddUserRoleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).AddUserRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_AddUserRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).AddUserRole(ctx, req.(*AddUserRoleReq))
}
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_DeleteUserRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteUserRoleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).DeleteUserRole(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_DeleteUserRole_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).DeleteUserRole(ctx, req.(*DeleteUserRoleReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -378,10 +480,22 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetUsers",
Handler: _EveningDetectiveServer_GetUsers_Handler,
},
{
MethodName: "GetUserById",
Handler: _EveningDetectiveServer_GetUserById_Handler,
},
{
MethodName: "GetMe",
Handler: _EveningDetectiveServer_GetMe_Handler,
},
{
MethodName: "AddUserRole",
Handler: _EveningDetectiveServer_AddUserRole_Handler,
},
{
MethodName: "DeleteUserRole",
Handler: _EveningDetectiveServer_DeleteUserRole_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",