feat: rbac完善,file接入完成
This commit is contained in:
@@ -14,18 +14,48 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
CommonResp = file.CommonResp
|
||||
FileInfo = file.FileInfo
|
||||
GetFileByIdReq = file.GetFileByIdReq
|
||||
GetFileByIdResp = file.GetFileByIdResp
|
||||
GetFilesByIdsReq = file.GetFilesByIdsReq
|
||||
GetFilesByIdsResp = file.GetFilesByIdsResp
|
||||
CheckFileByMd5Req = file.CheckFileByMd5Req
|
||||
CheckFileByMd5Resp = file.CheckFileByMd5Resp
|
||||
CommonResp = file.CommonResp
|
||||
CreateFileReq = file.CreateFileReq
|
||||
CreateFileResp = file.CreateFileResp
|
||||
CreateStorageConfigReq = file.CreateStorageConfigReq
|
||||
DeleteFilesReq = file.DeleteFilesReq
|
||||
FileInfo = file.FileInfo
|
||||
GetDefaultStorageConfigReq = file.GetDefaultStorageConfigReq
|
||||
GetDefaultStorageConfigResp = file.GetDefaultStorageConfigResp
|
||||
GetFileByIdReq = file.GetFileByIdReq
|
||||
GetFileByIdResp = file.GetFileByIdResp
|
||||
GetFileListReq = file.GetFileListReq
|
||||
GetFileListResp = file.GetFileListResp
|
||||
GetFilesByIdsReq = file.GetFilesByIdsReq
|
||||
GetFilesByIdsResp = file.GetFilesByIdsResp
|
||||
SetDefaultStorageConfigReq = file.SetDefaultStorageConfigReq
|
||||
StorageConfigInfo = file.StorageConfigInfo
|
||||
StorageConfigListReq = file.StorageConfigListReq
|
||||
StorageConfigListResp = file.StorageConfigListResp
|
||||
UpdateStorageConfigReq = file.UpdateStorageConfigReq
|
||||
|
||||
FileService interface {
|
||||
// 根据ID获取文件信息
|
||||
GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error)
|
||||
// 根据ID列表批量获取文件信息
|
||||
GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error)
|
||||
// 创建文件记录
|
||||
CreateFile(ctx context.Context, in *CreateFileReq, opts ...grpc.CallOption) (*CreateFileResp, error)
|
||||
// 通过MD5检查文件是否存在
|
||||
CheckFileByMd5(ctx context.Context, in *CheckFileByMd5Req, opts ...grpc.CallOption) (*CheckFileByMd5Resp, error)
|
||||
// 删除文件记录
|
||||
DeleteFiles(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
// 获取文件列表
|
||||
GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error)
|
||||
// ---------- 存储配置 ----------
|
||||
CreateStorageConfig(ctx context.Context, in *CreateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
UpdateStorageConfig(ctx context.Context, in *UpdateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
DeleteStorageConfig(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
SetDefaultStorageConfig(ctx context.Context, in *SetDefaultStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
||||
GetStorageConfigList(ctx context.Context, in *StorageConfigListReq, opts ...grpc.CallOption) (*StorageConfigListResp, error)
|
||||
GetDefaultStorageConfig(ctx context.Context, in *GetDefaultStorageConfigReq, opts ...grpc.CallOption) (*GetDefaultStorageConfigResp, error)
|
||||
}
|
||||
|
||||
defaultFileService struct {
|
||||
@@ -50,3 +80,58 @@ func (m *defaultFileService) GetFilesByIds(ctx context.Context, in *GetFilesById
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.GetFilesByIds(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 创建文件记录
|
||||
func (m *defaultFileService) CreateFile(ctx context.Context, in *CreateFileReq, opts ...grpc.CallOption) (*CreateFileResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.CreateFile(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 通过MD5检查文件是否存在
|
||||
func (m *defaultFileService) CheckFileByMd5(ctx context.Context, in *CheckFileByMd5Req, opts ...grpc.CallOption) (*CheckFileByMd5Resp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.CheckFileByMd5(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 删除文件记录
|
||||
func (m *defaultFileService) DeleteFiles(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.DeleteFiles(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// 获取文件列表
|
||||
func (m *defaultFileService) GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.GetFileList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// ---------- 存储配置 ----------
|
||||
func (m *defaultFileService) CreateStorageConfig(ctx context.Context, in *CreateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.CreateStorageConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultFileService) UpdateStorageConfig(ctx context.Context, in *UpdateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.UpdateStorageConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultFileService) DeleteStorageConfig(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.DeleteStorageConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultFileService) SetDefaultStorageConfig(ctx context.Context, in *SetDefaultStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.SetDefaultStorageConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultFileService) GetStorageConfigList(ctx context.Context, in *StorageConfigListReq, opts ...grpc.CallOption) (*StorageConfigListResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.GetStorageConfigList(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultFileService) GetDefaultStorageConfig(ctx context.Context, in *GetDefaultStorageConfigReq, opts ...grpc.CallOption) (*GetDefaultStorageConfigResp, error) {
|
||||
client := file.NewFileServiceClient(m.cli.Conn())
|
||||
return client.GetDefaultStorageConfig(ctx, in, opts...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user