Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(activity): add activity common service init

LinkinStars2f4090c25ee9
diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go
index 429771a2..3a4a8577 100644
--- a/cmd/wire_gen.go
+++ b/cmd/wire_gen.go
@@ -45,6 +45,7 @@ import (
"github.com/answerdev/answer/internal/service"
"github.com/answerdev/answer/internal/service/action"
activity2 "github.com/answerdev/answer/internal/service/activity"
+ activity_common2 "github.com/answerdev/answer/internal/service/activity_common"
"github.com/answerdev/answer/internal/service/activity_queue"
"github.com/answerdev/answer/internal/service/answer_common"
auth2 "github.com/answerdev/answer/internal/service/auth"
@@ -205,8 +206,9 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
uploaderService := uploader.NewUploaderService(serviceConf, siteInfoCommonService)
uploadController := controller.NewUploadController(uploaderService)
activityActivityRepo := activity.NewActivityRepo(dataData, configService)
+ activityCommon := activity_common2.NewActivityCommon(activityRepo, activityQueueService)
commentCommonService := comment_common.NewCommentCommonService(commentCommonRepo)
- activityService := activity2.NewActivityService(activityActivityRepo, userCommon, tagCommonService, objService, commentCommonService, revisionService, metaService, configService)
+ activityService := activity2.NewActivityService(activityActivityRepo, userCommon, activityCommon, tagCommonService, objService, commentCommonService, revisionService, metaService, configService)
activityController := controller.NewActivityController(activityService)
roleController := controller_admin.NewRoleController(roleService)
pluginConfigRepo := plugin_config.NewPluginConfigRepo(dataData)
diff --git a/internal/service/activity/activity.go b/internal/service/activity/activity.go
index 0b3f7dde..357de2a0 100644
--- a/internal/service/activity/activity.go
+++ b/internal/service/activity/activity.go
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "github.com/answerdev/answer/internal/service/activity_common"
"strings"
"github.com/answerdev/answer/internal/base/constant"
@@ -30,20 +31,22 @@ type ActivityRepo interface {
// ActivityService activity service
type ActivityService struct {
- activityRepo ActivityRepo
- userCommon *usercommon.UserCommon
- tagCommonService *tag_common.TagCommonService
- objectInfoService *object_info.ObjService
- commentCommonService *comment_common.CommentCommonService
- revisionService *revision_common.RevisionService
- metaService *meta.MetaService
- configService *config.ConfigService
+ activityRepo ActivityRepo
+ userCommon *usercommon.UserCommon
+ activityCommonService *activity_common.ActivityCommon
+ tagCommonService *tag_common.TagCommonService
+ objectInfoService *object_info.ObjService
+ commentCommonService *comment_common.CommentCommonService
+ revisionService *revision_common.RevisionService
+ metaService *meta.MetaService
+ configService *config.ConfigService
}
// NewActivityService new activity service
func NewActivityService(
activityRepo ActivityRepo,
userCommon *usercommon.UserCommon,
+ activityCommonService *activity_common.ActivityCommon,
tagCommonService *tag_common.TagCommonService,
objectInfoService *object_info.ObjService,
commentCommonService *comment_common.CommentCommonService,
@@ -52,14 +55,15 @@ func NewActivityService(
configService *config.ConfigService,
) *ActivityService {
return &ActivityService{
- objectInfoService: objectInfoService,
- activityRepo: activityRepo,
- userCommon: userCommon,
- tagCommonService: tagCommonService,
- commentCommonService: commentCommonService,
- revisionService: revisionService,
- metaService: metaService,
- configService: configService,
+ objectInfoService: objectInfoService,
+ activityRepo: activityRepo,
+ userCommon: userCommon,
+ activityCommonService: activityCommonService,
+ tagCommonService: tagCommonService,
+ commentCommonService: commentCommonService,
+ revisionService: revisionService,
+ metaService: metaService,
+ configService: configService,
}
}