Skip to content

Commit

Permalink
chore(badge): change project code struct
Browse files Browse the repository at this point in the history
  • Loading branch information
kumfo committed Aug 9, 2024
1 parent 203062d commit c2531f9
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 39 deletions.
3 changes: 1 addition & 2 deletions cmd/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6740,14 +6740,14 @@ const docTemplate = `{
},
"/custom.css": {
"get": {
"description": "get site robots information",
"description": "get site custom CSS",
"produces": [
"application/json"
"text/css"
],
"tags": [
"site"
],
"summary": "get site robots information",
"summary": "get site custom CSS",
"responses": {
"200": {
"description": "OK",
Expand Down
6 changes: 3 additions & 3 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6710,14 +6710,14 @@
},
"/custom.css": {
"get": {
"description": "get site robots information",
"description": "get site custom CSS",
"produces": [
"application/json"
"text/css"
],
"tags": [
"site"
],
"summary": "get site robots information",
"summary": "get site custom CSS",
"responses": {
"200": {
"description": "OK",
Expand Down
6 changes: 3 additions & 3 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6846,15 +6846,15 @@ paths:
- Activity
/custom.css:
get:
description: get site robots information
description: get site custom CSS
produces:
- application/json
- text/css
responses:
"200":
description: OK
schema:
type: string
summary: get site robots information
summary: get site custom CSS
tags:
- site
/installation/base-info:
Expand Down
5 changes: 2 additions & 3 deletions internal/controller/badge_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@ import (
"github.com/apache/incubator-answer/internal/base/pager"
"github.com/apache/incubator-answer/internal/schema"
"github.com/apache/incubator-answer/internal/service/badge"
"github.com/apache/incubator-answer/internal/service/badge_award"
"github.com/apache/incubator-answer/pkg/uid"
"github.com/gin-gonic/gin"
)

type BadgeController struct {
badgeService *badge.BadgeService
badgeAwardService *badge_award.BadgeAwardService
badgeAwardService *badge.BadgeAwardService
}

func NewBadgeController(
badgeService *badge.BadgeService,
badgeAwardService *badge_award.BadgeAwardService) *BadgeController {
badgeAwardService *badge.BadgeAwardService) *BadgeController {
return &BadgeController{
badgeService: badgeService,
badgeAwardService: badgeAwardService,
Expand Down
2 changes: 1 addition & 1 deletion internal/repo/badge/badge_event_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ func (br *eventRuleRepo) createBadgeAward(userID, badgeID, objectID string) (awa
return &entity.BadgeAward{
UserID: userID,
BadgeID: badgeID,
ObjectID: objectID,
AwardKey: objectID,
}
}
4 changes: 2 additions & 2 deletions internal/repo/badge_award/badge_award_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/apache/incubator-answer/internal/base/pager"
"github.com/apache/incubator-answer/internal/base/reason"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/service/badge_award"
"github.com/apache/incubator-answer/internal/service/badge"
"github.com/apache/incubator-answer/internal/service/unique"
"github.com/segmentfault/pacman/errors"
)
Expand All @@ -35,7 +35,7 @@ type badgeAwardRepo struct {
uniqueIDRepo unique.UniqueIDRepo
}

func NewBadgeAwardRepo(data *data.Data, uniqueIDRepo unique.UniqueIDRepo) badge_award.BadgeAwardRepo {
func NewBadgeAwardRepo(data *data.Data, uniqueIDRepo unique.UniqueIDRepo) badge.BadgeAwardRepo {
return &badgeAwardRepo{
data: data,
uniqueIDRepo: uniqueIDRepo,
Expand Down
4 changes: 2 additions & 2 deletions internal/repo/badge_group/badge_group_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"context"
"github.com/apache/incubator-answer/internal/base/data"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/service/badge_group"
"github.com/apache/incubator-answer/internal/service/badge"
"github.com/apache/incubator-answer/internal/service/unique"
)

Expand All @@ -32,7 +32,7 @@ type badgeGroupRepo struct {
uniqueIDRepo unique.UniqueIDRepo
}

func NewBadgeGroupRepo(data *data.Data, uniqueIDRepo unique.UniqueIDRepo) badge_group.BadgeGroupRepo {
func NewBadgeGroupRepo(data *data.Data, uniqueIDRepo unique.UniqueIDRepo) badge.BadgeGroupRepo {
return &badgeGroupRepo{
data: data,
uniqueIDRepo: uniqueIDRepo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
* under the License.
*/

package badge_award
package badge

import (
"context"
"github.com/apache/incubator-answer/internal/base/reason"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/schema"
"github.com/apache/incubator-answer/internal/service/badge"
"github.com/apache/incubator-answer/internal/service/object_info"
usercommon "github.com/apache/incubator-answer/internal/service/user_common"
"github.com/jinzhu/copier"
Expand Down Expand Up @@ -62,15 +61,15 @@ type BadgeAwardRepo interface {
}

type BadgeAwardService struct {
badgeAwardRepo BadgeAwardRepo
badgeRepo badge.BadgeRepo
userCommon *usercommon.UserCommon
badgeAwardRepo BadgeAwardRepo
badgeRepo BadgeRepo
userCommon *usercommon.UserCommon
objectInfoService *object_info.ObjService
}

func NewBadgeAwardService(
badgeAwardRepo BadgeAwardRepo,
badgeRepo badge.BadgeRepo,
badgeRepo BadgeRepo,
userCommon *usercommon.UserCommon,
objectInfoService *object_info.ObjService,
) *BadgeAwardService {
Expand Down
3 changes: 1 addition & 2 deletions internal/service/badge/badge_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package badge
import (
"context"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/service/badge_award"
"github.com/apache/incubator-answer/internal/service/event_queue"
"github.com/segmentfault/pacman/log"

Expand All @@ -33,7 +32,7 @@ import (
type BadgeEventService struct {
data *data.Data
eventQueueService event_queue.EventQueueService
badgeAwardRepo badge_award.BadgeAwardRepo
badgeAwardRepo BadgeAwardRepo
badgeRepo BadgeRepo
eventRuleRepo EventRuleRepo
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package badge_group
package badge

import (
"context"
Expand Down
12 changes: 5 additions & 7 deletions internal/service/badge/badge_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
"github.com/apache/incubator-answer/internal/base/translator"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/schema"
"github.com/apache/incubator-answer/internal/service/badge_award"
"github.com/apache/incubator-answer/internal/service/badge_group"
"github.com/apache/incubator-answer/pkg/converter"
"github.com/apache/incubator-answer/pkg/uid"
"github.com/gin-gonic/gin"
Expand All @@ -48,16 +46,16 @@ type BadgeRepo interface {
}

type BadgeService struct {
badgeRepo BadgeRepo
badgeGroupRepo badge_group.BadgeGroupRepo
badgeAwardRepo badge_award.BadgeAwardRepo
badgeRepo BadgeRepo
badgeGroupRepo BadgeGroupRepo
badgeAwardRepo BadgeAwardRepo
badgeEventService *BadgeEventService
}

func NewBadgeService(
badgeRepo BadgeRepo,
badgeGroupRepo badge_group.BadgeGroupRepo,
badgeAwardRepo badge_award.BadgeAwardRepo,
badgeGroupRepo BadgeGroupRepo,
badgeAwardRepo BadgeAwardRepo,
badgeEventService *BadgeEventService,
) *BadgeService {
return &BadgeService{
Expand Down
6 changes: 2 additions & 4 deletions internal/service/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
answercommon "github.com/apache/incubator-answer/internal/service/answer_common"
"github.com/apache/incubator-answer/internal/service/auth"
"github.com/apache/incubator-answer/internal/service/badge"
"github.com/apache/incubator-answer/internal/service/badge_award"
"github.com/apache/incubator-answer/internal/service/badge_group"
"github.com/apache/incubator-answer/internal/service/collection"
collectioncommon "github.com/apache/incubator-answer/internal/service/collection_common"
"github.com/apache/incubator-answer/internal/service/comment"
Expand Down Expand Up @@ -124,6 +122,6 @@ var ProviderSetService = wire.NewSet(
event_queue.NewEventQueueService,
badge.NewBadgeService,
badge.NewBadgeEventService,
badge_award.NewBadgeAwardService,
badge_group.NewBadgeGroupService,
badge.NewBadgeAwardService,
badge.NewBadgeGroupService,
)

0 comments on commit c2531f9

Please sign in to comment.