From f32f467a8495ab0934028213cd795c1e1b1bb180 Mon Sep 17 00:00:00 2001 From: zhouop0 <11733741+zhouop0@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:47:37 +0800 Subject: [PATCH] add swagger --- docs/docs.go | 16 +++++++++++++++- docs/swagger.json | 16 +++++++++++++++- docs/swagger.yaml | 11 ++++++++++- internal/api/dispute_game_handler.go | 2 +- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 5a6679b..9124181 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -120,7 +120,7 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/api.AmountPerDay" + "$ref": "#/definitions/api.CountGames" } } } @@ -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": { diff --git a/docs/swagger.json b/docs/swagger.json index f5f2910..3c7961a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -109,7 +109,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/api.AmountPerDay" + "$ref": "#/definitions/api.CountGames" } } } @@ -228,6 +228,20 @@ } } }, + "api.CountGames": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "date": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, "api.Overview": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 22fb8fd..6c06a21 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -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: @@ -93,7 +102,7 @@ paths: description: OK schema: items: - $ref: '#/definitions/api.AmountPerDay' + $ref: '#/definitions/api.CountGames' type: array summary: GetCountDisputeGameGroupByStatus /disputegames/credit/rank: diff --git a/internal/api/dispute_game_handler.go b/internal/api/dispute_game_handler.go index 86a0f3d..3897827 100644 --- a/internal/api/dispute_game_handler.go +++ b/internal/api/dispute_game_handler.go @@ -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"))