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.

chore(swagger): Regenerate the swagger document

LinkinStar14b72a1b33ba
diff --git a/docs/docs.go b/docs/docs.go
index edd782a7..54963ef1 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -4677,6 +4677,46 @@ const docTemplate = `{
}
}
},
+ "/answer/api/v1/user/ranking": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get user ranking",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "get user ranking",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.UserRankingResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/user/register/email": {
"post": {
"description": "UserRegisterByEmail",
@@ -6904,6 +6944,9 @@ const docTemplate = `{
"branding": {
"$ref": "#/definitions/schema.SiteBrandingResp"
},
+ "custom_css_html": {
+ "$ref": "#/definitions/schema.SiteCustomCssHTMLResp"
+ },
"general": {
"$ref": "#/definitions/schema.SiteGeneralResp"
},
@@ -7571,6 +7614,54 @@ const docTemplate = `{
}
}
},
+ "schema.UserRankingResp": {
+ "type": "object",
+ "properties": {
+ "staffs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ },
+ "users_with_the_most_reputation": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ },
+ "users_with_the_most_vote": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ }
+ }
+ },
+ "schema.UserRankingSimpleInfo": {
+ "type": "object",
+ "properties": {
+ "avatar": {
+ "description": "avatar",
+ "type": "string"
+ },
+ "display_name": {
+ "description": "display name",
+ "type": "string"
+ },
+ "rank": {
+ "description": "rank",
+ "type": "integer"
+ },
+ "username": {
+ "description": "username",
+ "type": "string"
+ },
+ "vote_count": {
+ "description": "vote",
+ "type": "integer"
+ }
+ }
+ },
"schema.UserRePassWordRequest": {
"type": "object",
"required": [
diff --git a/docs/swagger.json b/docs/swagger.json
index fa899855..e931ad53 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -4665,6 +4665,46 @@
}
}
},
+ "/answer/api/v1/user/ranking": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get user ranking",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "get user ranking",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.UserRankingResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/api/v1/user/register/email": {
"post": {
"description": "UserRegisterByEmail",
@@ -6892,6 +6932,9 @@
"branding": {
"$ref": "#/definitions/schema.SiteBrandingResp"
},
+ "custom_css_html": {
+ "$ref": "#/definitions/schema.SiteCustomCssHTMLResp"
+ },
"general": {
"$ref": "#/definitions/schema.SiteGeneralResp"
},
@@ -7559,6 +7602,54 @@
}
}
},
+ "schema.UserRankingResp": {
+ "type": "object",
+ "properties": {
+ "staffs": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ },
+ "users_with_the_most_reputation": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ },
+ "users_with_the_most_vote": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.UserRankingSimpleInfo"
+ }
+ }
+ }
+ },
+ "schema.UserRankingSimpleInfo": {
+ "type": "object",
+ "properties": {
+ "avatar": {
+ "description": "avatar",
+ "type": "string"
+ },
+ "display_name": {
+ "description": "display name",
+ "type": "string"
+ },
+ "rank": {
+ "description": "rank",
+ "type": "integer"
+ },
+ "username": {
+ "description": "username",
+ "type": "string"
+ },
+ "vote_count": {
+ "description": "vote",
+ "type": "integer"
+ }
+ }
+ },
"schema.UserRePassWordRequest": {
"type": "object",
"required": [
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index e2802ad4..18f5b83d 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1294,6 +1294,8 @@ definitions:
properties:
branding:
$ref: '#/definitions/schema.SiteBrandingResp'
+ custom_css_html:
+ $ref: '#/definitions/schema.SiteCustomCssHTMLResp'
general:
$ref: '#/definitions/schema.SiteGeneralResp'
interface:
@@ -1762,6 +1764,39 @@ definitions:
notice_switch:
type: boolean
type: object
+ schema.UserRankingResp:
+ properties:
+ staffs:
+ items:
+ $ref: '#/definitions/schema.UserRankingSimpleInfo'
+ type: array
+ users_with_the_most_reputation:
+ items:
+ $ref: '#/definitions/schema.UserRankingSimpleInfo'
+ type: array
+ users_with_the_most_vote:
+ items:
+ $ref: '#/definitions/schema.UserRankingSimpleInfo'
+ type: array
+ type: object
+ schema.UserRankingSimpleInfo:
+ properties:
+ avatar:
+ description: avatar
+ type: string
+ display_name:
+ description: display name
+ type: string
+ rank:
+ description: rank
+ type: integer
+ username:
+ description: username
+ type: string
+ vote_count:
+ description: vote
+ type: integer
+ type: object
schema.UserRePassWordRequest:
properties:
code:
@@ -4670,6 +4705,28 @@ paths:
summary: RetrievePassWord
tags:
- User
+ /answer/api/v1/user/ranking:
+ get:
+ consumes:
+ - application/json
+ description: get user ranking
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.UserRankingResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get user ranking
+ tags:
+ - User
/answer/api/v1/user/register/email:
post:
consumes:
diff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.go
index 47ebdf30..0f7f2975 100644
--- a/internal/controller/user_controller.go
+++ b/internal/controller/user_controller.go
@@ -496,7 +496,7 @@ func (uc *UserController) UserChangeEmailVerify(ctx *gin.Context) {
// @Accept json
// @Produce json
// @Security ApiKeyAuth
-// @Success 200 {object} handler.RespBody{data=schema.GetUserToSetShowResp}
+// @Success 200 {object} handler.RespBody{data=schema.UserRankingResp}
// @Router /answer/api/v1/user/ranking [get]
func (uc *UserController) UserRanking(ctx *gin.Context) {
resp, err := uc.userService.UserRanking(ctx)
diff --git a/internal/service/user_service.go b/internal/service/user_service.go
index 162cd91b..a8b4b3aa 100644
--- a/internal/service/user_service.go
+++ b/internal/service/user_service.go
@@ -582,7 +582,7 @@ func (us *UserService) UserRanking(ctx context.Context) (resp *schema.UserRankin
return nil, err
}
for _, stat := range rankStat {
- if stat.Rank == 0 {
+ if stat.Rank <= 0 {
continue
}
if userIDExist[stat.UserID] {