feat(badge): badge manage and user center's badge list

This commit is contained in:
kumfo
2024-08-13 16:12:34 +08:00
parent 290f63f2a1
commit bb40366f00
15 changed files with 807 additions and 17 deletions
+188
View File
@@ -154,6 +154,113 @@ const docTemplate = `{
}
}
},
"/answer/admin/api/badge/status": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "update badge status",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AdminBadge"
],
"summary": "update badge status",
"parameters": [
{
"description": "UpdateBadgeStatusReq",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.UpdateBadgeStatusReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/admin/api/badges": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "list all badges by page",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AdminBadge"
],
"summary": "list all badges by page",
"parameters": [
{
"type": "integer",
"description": "page",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size",
"name": "page_size",
"in": "query"
},
{
"enum": [
"",
"active",
"inactive"
],
"type": "string",
"description": "badge status",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handler.RespBody"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.GetBadgeListPagedResp"
}
}
}
}
]
}
}
}
}
},
"/answer/admin/api/dashboard": {
"get": {
"security": [
@@ -7652,6 +7759,17 @@ const docTemplate = `{
}
}
},
"schema.BadgeStatus": {
"type": "string",
"enum": [
"active",
"inactive"
],
"x-enum-varnames": [
"BadgeStatusActive",
"BadgeStatusInactive"
]
},
"schema.CloseQuestionReq": {
"type": "object",
"required": [
@@ -7944,6 +8062,55 @@ const docTemplate = `{
}
}
},
"schema.GetBadgeListPagedResp": {
"type": "object",
"properties": {
"award_count": {
"description": "badge award count",
"type": "integer"
},
"description": {
"description": "badge description",
"type": "string"
},
"earned": {
"description": "badge earned count",
"type": "boolean"
},
"group_name": {
"description": "badge group name",
"type": "string"
},
"icon": {
"description": "badge icon",
"type": "string"
},
"id": {
"description": "badge id",
"type": "string"
},
"level": {
"description": "badge level",
"allOf": [
{
"$ref": "#/definitions/entity.BadgeLevel"
}
]
},
"name": {
"description": "badge name",
"type": "string"
},
"status": {
"description": "badge status",
"allOf": [
{
"$ref": "#/definitions/schema.BadgeStatus"
}
]
}
}
},
"schema.GetBadgeListResp": {
"type": "object",
"properties": {
@@ -10446,6 +10613,27 @@ const docTemplate = `{
}
}
},
"schema.UpdateBadgeStatusReq": {
"type": "object",
"required": [
"id",
"status"
],
"properties": {
"id": {
"description": "badge id",
"type": "string"
},
"status": {
"description": "badge status",
"allOf": [
{
"$ref": "#/definitions/schema.BadgeStatus"
}
]
}
}
},
"schema.UpdateCommentReq": {
"type": "object",
"required": [
+188
View File
@@ -124,6 +124,113 @@
}
}
},
"/answer/admin/api/badge/status": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "update badge status",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AdminBadge"
],
"summary": "update badge status",
"parameters": [
{
"description": "UpdateBadgeStatusReq",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.UpdateBadgeStatusReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/admin/api/badges": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "list all badges by page",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"AdminBadge"
],
"summary": "list all badges by page",
"parameters": [
{
"type": "integer",
"description": "page",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "page size",
"name": "page_size",
"in": "query"
},
{
"enum": [
"",
"active",
"inactive"
],
"type": "string",
"description": "badge status",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handler.RespBody"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.GetBadgeListPagedResp"
}
}
}
}
]
}
}
}
}
},
"/answer/admin/api/dashboard": {
"get": {
"security": [
@@ -7622,6 +7729,17 @@
}
}
},
"schema.BadgeStatus": {
"type": "string",
"enum": [
"active",
"inactive"
],
"x-enum-varnames": [
"BadgeStatusActive",
"BadgeStatusInactive"
]
},
"schema.CloseQuestionReq": {
"type": "object",
"required": [
@@ -7914,6 +8032,55 @@
}
}
},
"schema.GetBadgeListPagedResp": {
"type": "object",
"properties": {
"award_count": {
"description": "badge award count",
"type": "integer"
},
"description": {
"description": "badge description",
"type": "string"
},
"earned": {
"description": "badge earned count",
"type": "boolean"
},
"group_name": {
"description": "badge group name",
"type": "string"
},
"icon": {
"description": "badge icon",
"type": "string"
},
"id": {
"description": "badge id",
"type": "string"
},
"level": {
"description": "badge level",
"allOf": [
{
"$ref": "#/definitions/entity.BadgeLevel"
}
]
},
"name": {
"description": "badge name",
"type": "string"
},
"status": {
"description": "badge status",
"allOf": [
{
"$ref": "#/definitions/schema.BadgeStatus"
}
]
}
}
},
"schema.GetBadgeListResp": {
"type": "object",
"properties": {
@@ -10416,6 +10583,27 @@
}
}
},
"schema.UpdateBadgeStatusReq": {
"type": "object",
"required": [
"id",
"status"
],
"properties": {
"id": {
"description": "badge id",
"type": "string"
},
"status": {
"description": "badge status",
"allOf": [
{
"$ref": "#/definitions/schema.BadgeStatus"
}
]
}
}
},
"schema.UpdateCommentReq": {
"type": "object",
"required": [
+118
View File
@@ -374,6 +374,14 @@ definitions:
description: badge name
type: string
type: object
schema.BadgeStatus:
enum:
- active
- inactive
type: string
x-enum-varnames:
- BadgeStatusActive
- BadgeStatusInactive
schema.CloseQuestionReq:
properties:
close_msg:
@@ -573,6 +581,38 @@ definitions:
description: badge name
type: string
type: object
schema.GetBadgeListPagedResp:
properties:
award_count:
description: badge award count
type: integer
description:
description: badge description
type: string
earned:
description: badge earned count
type: boolean
group_name:
description: badge group name
type: string
icon:
description: badge icon
type: string
id:
description: badge id
type: string
level:
allOf:
- $ref: '#/definitions/entity.BadgeLevel'
description: badge level
name:
description: badge name
type: string
status:
allOf:
- $ref: '#/definitions/schema.BadgeStatus'
description: badge status
type: object
schema.GetBadgeListResp:
properties:
badges:
@@ -2307,6 +2347,19 @@ definitions:
url_title:
type: string
type: object
schema.UpdateBadgeStatusReq:
properties:
id:
description: badge id
type: string
status:
allOf:
- $ref: '#/definitions/schema.BadgeStatus'
description: badge status
required:
- id
- status
type: object
schema.UpdateCommentReq:
properties:
captcha_code:
@@ -2924,6 +2977,71 @@ paths:
summary: update answer status
tags:
- admin
/answer/admin/api/badge/status:
put:
consumes:
- application/json
description: update badge status
parameters:
- description: UpdateBadgeStatusReq
in: body
name: data
required: true
schema:
$ref: '#/definitions/schema.UpdateBadgeStatusReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: update badge status
tags:
- AdminBadge
/answer/admin/api/badges:
get:
consumes:
- application/json
description: list all badges by page
parameters:
- description: page
in: query
name: page
type: integer
- description: page size
in: query
name: page_size
type: integer
- description: badge status
enum:
- ""
- active
- inactive
in: query
name: status
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
items:
$ref: '#/definitions/schema.GetBadgeListPagedResp'
type: array
type: object
security:
- ApiKeyAuth: []
summary: list all badges by page
tags:
- AdminBadge
/answer/admin/api/dashboard:
get:
consumes: