add permissions route

This commit is contained in:
2026-07-07 00:46:55 +07:00
parent 612c3a6f86
commit 377dd26e3e
8 changed files with 342 additions and 19 deletions
+38
View File
@@ -30,6 +30,7 @@ const (
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"
EveningDetectiveServer_GetPermissions_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetPermissions"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
@@ -47,6 +48,7 @@ type EveningDetectiveServerClient interface {
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)
GetPermissions(ctx context.Context, in *GetPermissionsReq, opts ...grpc.CallOption) (*GetPermissionsRsp, error)
}
type eveningDetectiveServerClient struct {
@@ -167,6 +169,16 @@ func (c *eveningDetectiveServerClient) DeleteUserRole(ctx context.Context, in *D
return out, nil
}
func (c *eveningDetectiveServerClient) GetPermissions(ctx context.Context, in *GetPermissionsReq, opts ...grpc.CallOption) (*GetPermissionsRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetPermissionsRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_GetPermissions_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.
@@ -182,6 +194,7 @@ type EveningDetectiveServerServer interface {
GetMe(context.Context, *GetMeReq) (*GetMeRsp, error)
AddUserRole(context.Context, *AddUserRoleReq) (*AddUserRoleRsp, error)
DeleteUserRole(context.Context, *DeleteUserRoleReq) (*DeleteUserRoleRsp, error)
GetPermissions(context.Context, *GetPermissionsReq) (*GetPermissionsRsp, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
@@ -225,6 +238,9 @@ func (UnimplementedEveningDetectiveServerServer) AddUserRole(context.Context, *A
func (UnimplementedEveningDetectiveServerServer) DeleteUserRole(context.Context, *DeleteUserRoleReq) (*DeleteUserRoleRsp, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteUserRole not implemented")
}
func (UnimplementedEveningDetectiveServerServer) GetPermissions(context.Context, *GetPermissionsReq) (*GetPermissionsRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetPermissions not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
@@ -445,6 +461,24 @@ func _EveningDetectiveServer_DeleteUserRole_Handler(srv interface{}, ctx context
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_GetPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPermissionsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).GetPermissions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_GetPermissions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).GetPermissions(ctx, req.(*GetPermissionsReq))
}
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)
@@ -496,6 +530,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteUserRole",
Handler: _EveningDetectiveServer_DeleteUserRole_Handler,
},
{
MethodName: "GetPermissions",
Handler: _EveningDetectiveServer_GetPermissions_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",