mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-08 19:40:24 +08:00
增加文件相关API
This commit is contained in:
@@ -32,11 +32,13 @@ func (this *FileChunkService) CreateFileChunk(ctx context.Context, req *pb.Creat
|
||||
// 获取的一个文件的所有片段IDs
|
||||
func (this *FileChunkService) FindAllFileChunkIds(ctx context.Context, req *pb.FindAllFileChunkIdsRequest) (*pb.FindAllFileChunkIdsResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode, rpcutils.UserTypeAdmin)
|
||||
_, _, err := this.ValidateAdminAndUser(ctx, 0, -1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO 校验用户
|
||||
|
||||
tx := this.NullTx()
|
||||
|
||||
chunkIds, err := models.SharedFileChunkDAO.FindAllFileChunkIds(tx, req.FileId)
|
||||
@@ -49,11 +51,13 @@ func (this *FileChunkService) FindAllFileChunkIds(ctx context.Context, req *pb.F
|
||||
// 下载文件片段
|
||||
func (this *FileChunkService) DownloadFileChunk(ctx context.Context, req *pb.DownloadFileChunkRequest) (*pb.DownloadFileChunkResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode, rpcutils.UserTypeAdmin)
|
||||
_, _, err := this.ValidateAdminAndUser(ctx, 0, -1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO 校验用户
|
||||
|
||||
tx := this.NullTx()
|
||||
|
||||
chunk, err := models.SharedFileChunkDAO.FindFileChunk(tx, req.FileChunkId)
|
||||
|
||||
Reference in New Issue
Block a user