diff --git a/biz/application/service/file.go b/biz/application/service/file.go index 0c24ed2..d1dd6ca 100644 --- a/biz/application/service/file.go +++ b/biz/application/service/file.go @@ -795,6 +795,7 @@ func (s *FileService) AddFileToPublicSpace(ctx context.Context, req *gencontent. resp = new(gencontent.AddFileToPublicSpaceResp) update := bson.M{ "$set": bson.M{ + consts.AuditStatus: int64(gencontent.AuditStatus_AuditStatus_wait), consts.Zone: req.Zone, consts.SubZone: req.SubZone, consts.Description: req.Description, @@ -836,7 +837,7 @@ func (s *FileService) AddFileToPublicSpace(ctx context.Context, req *gencontent. func (s *FileService) MakeFilePrivate(ctx context.Context, req *gencontent.MakeFilePrivateReq) (resp *gencontent.MakeFilePrivateResp, err error) { resp = &gencontent.MakeFilePrivateResp{} - data := convertor.FileToFileMapper(&gencontent.File{FileId: req.FileId}) + data := convertor.FileToFileMapper(&gencontent.File{FileId: req.FileId, AuditStatus: int64(gencontent.AuditStatus_AuditStatus_notStart)}) update := bson.M{ consts.Zone: "", consts.SubZone: "", @@ -847,7 +848,7 @@ func (s *FileService) MakeFilePrivate(ctx context.Context, req *gencontent.MakeF return resp, err } - res, _ := sonic.Marshal(&message.DeleteFileRelationsMessage{ + res, _ := sonic.Marshal(&message.DeleteFileRelationsMessage{ FromType: int64(gencontent.TargetType_UserType), FromId: req.UserId, ToType: int64(gencontent.TargetType_FileType), diff --git a/biz/infrastructure/consts/field.go b/biz/infrastructure/consts/field.go index 01b0dfa..d88c177 100644 --- a/biz/infrastructure/consts/field.go +++ b/biz/infrastructure/consts/field.go @@ -28,6 +28,7 @@ const ( CreateAt = "createAt" UpdateAt = "updateAt" DeletedAt = "deletedAt" + AuditStatus = "auditStatus" TargetId = "targetId" TargetType = "targetType" RelationType = "relationType" diff --git a/biz/infrastructure/convertor/convertor.go b/biz/infrastructure/convertor/convertor.go index 3489e39..10eb4a4 100644 --- a/biz/infrastructure/convertor/convertor.go +++ b/biz/infrastructure/convertor/convertor.go @@ -48,6 +48,7 @@ func FileMapperToFile(data *file.File) *gencontent.FileInfo { Zone: data.Zone, SubZone: data.SubZone, Description: data.Description, + AuditStatus: data.AuditStatus, Labels: data.Labels, CreateAt: data.CreateAt.UnixMilli(), UpdateAt: data.UpdateAt.UnixMilli(), @@ -71,6 +72,7 @@ func FileToFileMapper(data *gencontent.File) *file.File { SubZone: data.SubZone, Description: data.Description, Labels: data.Labels, + AuditStatus: data.AuditStatus, } } @@ -137,6 +139,7 @@ func FileFilterOptionsToFilterOptions(opts *gencontent.FileFilterOptions) (filte OnlyIsDel: opts.OnlyIsDel, OnlyDocumentType: opts.OnlyDocumentType, OnlyType: opts.OnlyType, + OnlyAuditStatus: opts.OnlyAuditStatus, OnlyCategory: opts.OnlyCategory, OnlyLabelId: opts.OnlyLabelId, } diff --git a/biz/infrastructure/mapper/file/filter.go b/biz/infrastructure/mapper/file/filter.go index 99a660c..bffbd72 100644 --- a/biz/infrastructure/mapper/file/filter.go +++ b/biz/infrastructure/mapper/file/filter.go @@ -21,6 +21,7 @@ type FilterOptions struct { OnlyDocumentType *int64 OnlyType []string OnlyCategory *int64 + OnlyAuditStatus *int64 OnlyLabelId *string } @@ -45,10 +46,17 @@ func (f *MongoFileFilter) toBson() bson.M { f.CheckOnlyDocumentType() f.CheckOnlyType() f.CheckOnlyCategory() + f.CheckOnlyAuditStatus() f.CheckOnlyLabelId() return f.m } +func (f *MongoFileFilter) CheckOnlyAuditStatus() { + if f.OnlyDocumentType != nil && *f.OnlyDocumentType == int64(gencontent.Space_Space_public) && f.OnlyAuditStatus != nil { + f.m[consts.AuditStatus] = *f.OnlyAuditStatus + } +} + func (f *MongoFileFilter) CheckOnlyType() { if f.OnlyType != nil { f.m[consts.Type] = bson.M{ diff --git a/biz/infrastructure/mapper/file/mongo.go b/biz/infrastructure/mapper/file/mongo.go index 8bf924c..7178700 100644 --- a/biz/infrastructure/mapper/file/mongo.go +++ b/biz/infrastructure/mapper/file/mongo.go @@ -68,6 +68,7 @@ type ( Zone string `bson:"zone,omitempty" json:"zone,omitempty"` SubZone string `bson:"subZone,omitempty" json:"subZone,omitempty"` Description string `bson:"description,omitempty" json:"description,omitempty"` + AuditStatus int64 `bson:"auditStatus,omitempty" json:"auditStatus,omitempty"` Labels []string `bson:"labels,omitempty" json:"labels,omitempty"` CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` diff --git a/go.mod b/go.mod index ff5c5f2..32c9804 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/CloudStriver/go-pkg v0.0.0-20240329084540-20ca37a52fea - github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402115528-0964d5751a70 + github.com/CloudStriver/service-idl-gen-go v0.0.0-20240405080147-4f6e87e49c35 github.com/bytedance/sonic v1.10.2 github.com/cloudwego/kitex v0.8.0 github.com/elastic/go-elasticsearch/v8 v8.11.1 diff --git a/go.sum b/go.sum index 8905dee..40c80fd 100644 --- a/go.sum +++ b/go.sum @@ -395,6 +395,8 @@ github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402021409-326abc356747 h1 github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402021409-326abc356747/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402115528-0964d5751a70 h1:rL3mK+nM3aTgYqAxjz32C0A5kuvi07910bbyt37PuUM= github.com/CloudStriver/service-idl-gen-go v0.0.0-20240402115528-0964d5751a70/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240405080147-4f6e87e49c35 h1:lrNmnBVXjs3hOha7f0mfFQlnb2hv5yQRPhrGsmbs0uA= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240405080147-4f6e87e49c35/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=