Skip to content

Commit

Permalink
feat: getFileList添加新返回值 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansongxx authored Feb 2, 2024
1 parent 2a6de00 commit 02322a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions biz/application/service/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package service
import (
"context"
"errors"
"fmt"
"github.com/CloudStriver/cloudmind-content/biz/infrastructure/consts"
"github.com/CloudStriver/cloudmind-content/biz/infrastructure/convertor"
filemapper "github.com/CloudStriver/cloudmind-content/biz/infrastructure/mapper/file"
Expand Down Expand Up @@ -91,7 +90,7 @@ func (s *FileService) GetFile(ctx context.Context, req *gencontent.GetFileReq) (

func (s *FileService) GetFileList(ctx context.Context, req *gencontent.GetFileListReq) (resp *gencontent.GetFileListResp, err error) {
resp = new(gencontent.GetFileListResp)
resp.FatherPath = "CloudMind"
resp.FatherNamePath = "CloudMind"
var (
files []*filemapper.File
total int64
Expand All @@ -105,13 +104,14 @@ func (s *FileService) GetFileList(ctx context.Context, req *gencontent.GetFileLi
OnlyFileId: lo.ToPtr(req.GetFilterOptions().GetOnlyFatherId()),
},
})
fmt.Println(getFileResp)
if errors.Is(err1, consts.ErrNotFound) {
resp.FatherIdPath = req.GetFilterOptions().GetOnlyFatherId()
return nil
}
if err1 != nil {
return err1
}
resp.FatherIdPath = getFileResp.File.Path
paths := strings.Split(getFileResp.File.Path, "/")
if len(paths) > 1 {
filelist, err1 := s.FileMongoMapper.FindManyNotPagination(ctx, &filemapper.FilterOptions{
Expand All @@ -121,7 +121,7 @@ func (s *FileService) GetFileList(ctx context.Context, req *gencontent.GetFileLi
return err1
}
lo.ForEach(filelist, func(item *filemapper.File, _ int) {
resp.FatherPath += "/" + item.Name
resp.FatherNamePath += "/" + item.Name
})
}
return nil
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/CloudStriver/go-pkg v0.0.0-20231229114943-910edcb8788d
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201091924-a3cefad75be4
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240202055044-f6076cb1d360
github.com/bytedance/sonic v1.10.2
github.com/cloudwego/kitex v0.8.0
github.com/elastic/go-elasticsearch/v8 v8.11.1
Expand All @@ -19,6 +19,9 @@ require (
google.golang.org/grpc v1.60.1
)

//replace (
// github.com/CloudStriver/service-idl-gen-go => ../service-idl-gen-go
//)
require (
github.com/apache/thrift v0.16.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CloudStriver/go-pkg v0.0.0-20231229114943-910edcb8788d h1:c5M3637HJJN+pD3erToZAw0vutEMLmC+5I63szm5PYU=
github.com/CloudStriver/go-pkg v0.0.0-20231229114943-910edcb8788d/go.mod h1:Oj6+J8ixQxqNunSpl9v64q6tAQ83wY/rRFI+3rhHVCk=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201060740-cadd39081dc7 h1:FUhcRGxdhBvxV3uFlbaiRjWJw516KM7wJLv9FhHUwvA=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201060740-cadd39081dc7/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201073608-8cd061d59e6d h1:wlZObzrhfV647crFvmvQsfxMftZ6ejCinzd84drnI7k=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201073608-8cd061d59e6d/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201082032-be9a2ef30717 h1:GQWaeW0C0gs85P6e6L3YTVzTnUSU7H1HCLZWcaj4F+U=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201082032-be9a2ef30717/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201091924-a3cefad75be4 h1:ePM5sgK+a9KIrIz0ceSzcJ+iW3ApSfFMAPM+RW8+x54=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240201091924-a3cefad75be4/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240202055044-f6076cb1d360 h1:sJXZXhB5cCkZC1P8FUilJ9F22xARfFH/ZdrE9ZbLhvY=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240202055044-f6076cb1d360/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
Expand Down

0 comments on commit 02322a9

Please sign in to comment.