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.

Merge remote-tracking branch 'origin/feat/0.6.0/seo' into test

LinkinStarf3e42f72ac6f
diff --cc cmd/answer/wire_gen.go
index fb67a16d,0f908a60..56b71382
--- a/cmd/answer/wire_gen.go
+++ b/cmd/answer/wire_gen.go
@@@ -190,22 -181,19 +191,25 @@@ func initApplication(debug bool, server
siteinfoController := controller.NewSiteinfoController(siteInfoCommonService)
notificationRepo := notification.NewNotificationRepo(dataData)
notificationCommon := notificationcommon.NewNotificationCommon(dataData, notificationRepo, userCommon, activityRepo, followRepo, objService)
- notificationService := notification2.NewNotificationService(dataData, notificationRepo, notificationCommon)
- notificationController := controller.NewNotificationController(notificationService)
+ notificationService := notification2.NewNotificationService(dataData, notificationRepo, notificationCommon, revisionService)
+ notificationController := controller.NewNotificationController(notificationService, rankService)
dashboardController := controller.NewDashboardController(dashboardService)
uploadController := controller.NewUploadController(uploaderService)
- answerAPIRouter := router.NewAnswerAPIRouter(langController, userController, commentController, reportController, voteController, tagController, followController, collectionController, questionController, answerController, searchController, revisionController, rankController, controller_backyardReportController, userBackyardController, reasonController, themeController, siteInfoController, siteinfoController, notificationController, dashboardController, uploadController)
+ activityCommon := activity_common2.NewActivityCommon(activityRepo)
+ activityActivityRepo := activity.NewActivityRepo(dataData)
+ commentCommonService := comment_common.NewCommentCommonService(commentCommonRepo)
+ activityService := activity2.NewActivityService(activityActivityRepo, userCommon, activityCommon, tagCommonService, objService, commentCommonService, revisionService, metaService)
+ activityController := controller.NewActivityController(activityCommon, activityService)
+ roleController := controller_backyard.NewRoleController(roleService)
+ answerAPIRouter := router.NewAnswerAPIRouter(langController, userController, commentController, reportController, voteController, tagController, followController, collectionController, questionController, answerController, searchController, revisionController, rankController, controller_backyardReportController, userBackyardController, reasonController, themeController, siteInfoController, siteinfoController, notificationController, dashboardController, uploadController, activityController, roleController)
swaggerRouter := router.NewSwaggerRouter(swaggerConf)
- uiRouter := router.NewUIRouter()
+ uiRouter := router.NewUIRouter(siteinfoController)
authUserMiddleware := middleware.NewAuthUserMiddleware(authService)
avatarMiddleware := middleware.NewAvatarMiddleware(serviceConf, uploaderService)
- ginEngine := server.NewHTTPServer(debug, staticRouter, answerAPIRouter, swaggerRouter, uiRouter, authUserMiddleware, avatarMiddleware)
+ templateRenderController := templaterender.NewTemplateRenderController(questionService, userService, tagService, answerService, commentService)
+ templateController := controller.NewTemplateController(templateRenderController, siteInfoCommonService)
+ templateRouter := router.NewTemplateRouter(templateController, templateRenderController, siteInfoController)
+ ginEngine := server.NewHTTPServer(debug, staticRouter, answerAPIRouter, swaggerRouter, uiRouter, authUserMiddleware, avatarMiddleware, templateRouter)
application := newApplication(serverConf, ginEngine)
return application, func() {
cleanup2()
diff --cc internal/controller/controller.go
index 5b3e34f3,48dcabd4..fcbca143
--- a/internal/controller/controller.go
+++ b/internal/controller/controller.go
@@@ -22,5 -22,5 +22,6 @@@ var ProviderSetController = wire.NewSet
NewSiteinfoController,
NewDashboardController,
NewUploadController,
+ NewActivityController,
+ NewTemplateController,
)
diff --cc internal/schema/siteinfo_schema.go
index 637b3bd6,920d8807..97ad7744
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@@ -8,10 -11,15 +11,15 @@@ const PermaLinkQuestionID =
// SiteGeneralReq site general request
type SiteGeneralReq struct {
Name string `validate:"required,gt=1,lte=128" form:"name" json:"name"`
- ShortDescription string `validate:"required,gt=3,lte=255" form:"short_description" json:"short_description"`
- Description string `validate:"required,gt=3,lte=2000" form:"description" json:"description"`
+ ShortDescription string `validate:"omitempty,gt=3,lte=255" form:"short_description" json:"short_description"`
+ Description string `validate:"omitempty,gt=3,lte=2000" form:"description" json:"description"`
SiteUrl string `validate:"required,gt=1,lte=512,url" form:"site_url" json:"site_url"`
ContactEmail string `validate:"required,gt=1,lte=512,email" form:"contact_email" json:"contact_email"`
+ PermaLink int `validate:"required,lte=3,gte=0" form:"permalink" json:"permalink"`
+ }
+
+ type SiteSeoReq struct {
+ Robots string `validate:"required" form:"robots" json:"robots"`
}
func (r *SiteGeneralReq) FormatSiteUrl() {
diff --cc internal/schema/tag_schema.go
index bf79d5aa,0dc53dae..796b6bb8
--- a/internal/schema/tag_schema.go
+++ b/internal/schema/tag_schema.go
@@@ -23,12 -23,19 +23,23 @@@ type GetTagInfoReq struct
Name string `validate:"omitempty,gt=0,lte=35" form:"name"`
// user id
UserID string `json:"-"`
+ // whether user can edit it
+ CanEdit bool `json:"-"`
+ // whether user can delete it
+ CanDelete bool `json:"-"`
}
+ type GetTamplateTagInfoReq struct {
+ // tag id
+ ID string `validate:"omitempty" form:"id"`
+ // tag slug name
+ Name string `validate:"omitempty" form:"name"`
+ // user id
+ UserID string `json:"-"`
+ Page int `validate:"omitempty,min=1" form:"page"`
+ PageSize int `validate:"omitempty,min=1" form:"page_size"`
+ }
+
func (r *GetTagInfoReq) Check() (errFields []*validator.FormErrorField, err error) {
if len(r.ID) == 0 && len(r.Name) == 0 {
return nil, errors.BadRequest(reason.RequestFormatError)