Skip to content

Commit

Permalink
add swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Jul 25, 2024
1 parent 367c0c0 commit f32f467
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
16 changes: 15 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.AmountPerDay"
"$ref": "#/definitions/api.CountGames"
}
}
}
Expand Down Expand Up @@ -239,6 +239,20 @@ const docTemplate = `{
}
}
},
"api.CountGames": {
"type": "object",
"properties": {
"amount": {
"type": "string"
},
"date": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.Overview": {
"type": "object",
"properties": {
Expand Down
16 changes: 15 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.AmountPerDay"
"$ref": "#/definitions/api.CountGames"
}
}
}
Expand Down Expand Up @@ -228,6 +228,20 @@
}
}
},
"api.CountGames": {
"type": "object",
"properties": {
"amount": {
"type": "string"
},
"date": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"api.Overview": {
"type": "object",
"properties": {
Expand Down
11 changes: 10 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ definitions:
date:
type: string
type: object
api.CountGames:
properties:
amount:
type: string
date:
type: string
status:
type: string
type: object
api.Overview:
properties:
challengerWinGamesCount:
Expand Down Expand Up @@ -93,7 +102,7 @@ paths:
description: OK
schema:
items:
$ref: '#/definitions/api.AmountPerDay'
$ref: '#/definitions/api.CountGames'
type: array
summary: GetCountDisputeGameGroupByStatus
/disputegames/credit/rank:
Expand Down
2 changes: 1 addition & 1 deletion internal/api/dispute_game_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ type CountGames struct {
// @Accept json
// @Produce json
// @Param days query int false "today before ? days"
// @Success 200 {object} []AmountPerDay
// @Success 200 {object} []CountGames
// @Router /disputegames/count [get]
func (h DisputeGameHandler) GetCountDisputeGameGroupByStatus(c *gin.Context) {
days := cast.ToInt(c.Query("days"))
Expand Down

0 comments on commit f32f467

Please sign in to comment.