Skip to content

Commit

Permalink
增加社区文件审核状态
Browse files Browse the repository at this point in the history
  • Loading branch information
Love-YeLin committed Apr 5, 2024
1 parent 0f557d5 commit 7de9a7c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions biz/application/service/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: "",
Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions biz/infrastructure/consts/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
CreateAt = "createAt"
UpdateAt = "updateAt"
DeletedAt = "deletedAt"
AuditStatus = "auditStatus"
TargetId = "targetId"
TargetType = "targetType"
RelationType = "relationType"
Expand Down
3 changes: 3 additions & 0 deletions biz/infrastructure/convertor/convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -71,6 +72,7 @@ func FileToFileMapper(data *gencontent.File) *file.File {
SubZone: data.SubZone,
Description: data.Description,
Labels: data.Labels,
AuditStatus: data.AuditStatus,
}
}

Expand Down Expand Up @@ -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,
}
Expand Down
8 changes: 8 additions & 0 deletions biz/infrastructure/mapper/file/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type FilterOptions struct {
OnlyDocumentType *int64
OnlyType []string
OnlyCategory *int64
OnlyAuditStatus *int64
OnlyLabelId *string
}

Expand All @@ -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{
Expand Down
1 change: 1 addition & 0 deletions biz/infrastructure/mapper/file/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 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-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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 7de9a7c

Please sign in to comment.