From ea1359209c55eb1e5ff52ecaed0c9a1c87f25eb8 Mon Sep 17 00:00:00 2001 From: Kosmatoff Date: Wed, 22 Nov 2023 16:37:33 +0300 Subject: [PATCH] update swagger --- docs/docs.go | 99 ++++++++++++++++--- docs/swagger.json | 99 ++++++++++++++++--- docs/swagger.yaml | 70 ++++++++++--- .../transaction/delivery/http/handlers.go | 2 +- 4 files changed, 234 insertions(+), 36 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 5158b1aa..57462aae 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -418,6 +418,50 @@ const docTemplate = `{ } } }, + "/api/transaction/count": { + "get": { + "description": "Get User count transaction", + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Get count transaction", + "responses": { + "200": { + "description": "Show transaction count", + "schema": { + "$ref": "#/definitions/http.Response-http_TransactionCount" + } + }, + "400": { + "description": "Client error", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "401": { + "description": "Unauthorized user", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "403": { + "description": "Forbidden user", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "500": { + "description": "Server error", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + } + } + } + }, "/api/transaction/create": { "post": { "description": "Create transaction", @@ -485,18 +529,33 @@ const docTemplate = `{ "summary": "Get all transaction", "parameters": [ { - "minimum": 1, - "type": "integer", - "example": 1, - "name": "page", + "type": "string", + "example": "uuid", + "name": "account", + "in": "query" + }, + { + "type": "string", + "example": "uuid", + "name": "category", + "in": "query" + }, + { + "type": "string", + "example": "2023-11-21T19:30:57+03:00", + "name": "date", + "in": "query" + }, + { + "type": "boolean", + "example": true, + "name": "income", "in": "query" }, { - "maximum": 20, - "minimum": 1, - "type": "integer", - "example": 10, - "name": "page_size", + "type": "boolean", + "example": true, + "name": "outcome", "in": "query" } ], @@ -1127,9 +1186,6 @@ const docTemplate = `{ "http.MasTransaction": { "type": "object", "properties": { - "is_all": { - "type": "boolean" - }, "transactions": { "type": "array", "items": { @@ -1210,6 +1266,17 @@ const docTemplate = `{ } } }, + "http.Response-http_TransactionCount": { + "type": "object", + "properties": { + "body": { + "$ref": "#/definitions/http.TransactionCount" + }, + "status": { + "type": "integer" + } + } + }, "http.Response-http_TransactionCreateResponse": { "type": "object", "properties": { @@ -1342,6 +1409,14 @@ const docTemplate = `{ } } }, + "http.TransactionCount": { + "type": "object", + "properties": { + "count": { + "type": "integer" + } + } + }, "http.TransactionCreateResponse": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index ce387ad8..cb2df7c8 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -412,6 +412,50 @@ } } }, + "/api/transaction/count": { + "get": { + "description": "Get User count transaction", + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Get count transaction", + "responses": { + "200": { + "description": "Show transaction count", + "schema": { + "$ref": "#/definitions/http.Response-http_TransactionCount" + } + }, + "400": { + "description": "Client error", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "401": { + "description": "Unauthorized user", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "403": { + "description": "Forbidden user", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + }, + "500": { + "description": "Server error", + "schema": { + "$ref": "#/definitions/http.ResponseError" + } + } + } + } + }, "/api/transaction/create": { "post": { "description": "Create transaction", @@ -479,18 +523,33 @@ "summary": "Get all transaction", "parameters": [ { - "minimum": 1, - "type": "integer", - "example": 1, - "name": "page", + "type": "string", + "example": "uuid", + "name": "account", + "in": "query" + }, + { + "type": "string", + "example": "uuid", + "name": "category", + "in": "query" + }, + { + "type": "string", + "example": "2023-11-21T19:30:57+03:00", + "name": "date", + "in": "query" + }, + { + "type": "boolean", + "example": true, + "name": "income", "in": "query" }, { - "maximum": 20, - "minimum": 1, - "type": "integer", - "example": 10, - "name": "page_size", + "type": "boolean", + "example": true, + "name": "outcome", "in": "query" } ], @@ -1121,9 +1180,6 @@ "http.MasTransaction": { "type": "object", "properties": { - "is_all": { - "type": "boolean" - }, "transactions": { "type": "array", "items": { @@ -1204,6 +1260,17 @@ } } }, + "http.Response-http_TransactionCount": { + "type": "object", + "properties": { + "body": { + "$ref": "#/definitions/http.TransactionCount" + }, + "status": { + "type": "integer" + } + } + }, "http.Response-http_TransactionCreateResponse": { "type": "object", "properties": { @@ -1336,6 +1403,14 @@ } } }, + "http.TransactionCount": { + "type": "object", + "properties": { + "count": { + "type": "integer" + } + } + }, "http.TransactionCreateResponse": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 74500cbe..fe23a5ed 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -57,8 +57,6 @@ definitions: type: object http.MasTransaction: properties: - is_all: - type: boolean transactions: items: $ref: '#/definitions/models.TransactionTransfer' @@ -110,6 +108,13 @@ definitions: status: type: integer type: object + http.Response-http_TransactionCount: + properties: + body: + $ref: '#/definitions/http.TransactionCount' + status: + type: integer + type: object http.Response-http_TransactionCreateResponse: properties: body: @@ -194,6 +199,11 @@ definitions: status: type: integer type: object + http.TransactionCount: + properties: + count: + type: integer + type: object http.TransactionCreateResponse: properties: transaction_id: @@ -653,6 +663,35 @@ paths: summary: Delete Transaction tags: - Transaction + /api/transaction/count: + get: + description: Get User count transaction + produces: + - application/json + responses: + "200": + description: Show transaction count + schema: + $ref: '#/definitions/http.Response-http_TransactionCount' + "400": + description: Client error + schema: + $ref: '#/definitions/http.ResponseError' + "401": + description: Unauthorized user + schema: + $ref: '#/definitions/http.ResponseError' + "403": + description: Forbidden user + schema: + $ref: '#/definitions/http.ResponseError' + "500": + description: Server error + schema: + $ref: '#/definitions/http.ResponseError' + summary: Get count transaction + tags: + - Transaction /api/transaction/create: post: description: Create transaction @@ -693,17 +732,26 @@ paths: get: description: Get User all transaction parameters: - - example: 1 + - example: uuid in: query - minimum: 1 - name: page - type: integer - - example: 10 + name: account + type: string + - example: uuid in: query - maximum: 20 - minimum: 1 - name: page_size - type: integer + name: category + type: string + - example: "2023-11-21T19:30:57+03:00" + in: query + name: date + type: string + - example: true + in: query + name: income + type: boolean + - example: true + in: query + name: outcome + type: boolean produces: - application/json responses: diff --git a/internal/microservices/transaction/delivery/http/handlers.go b/internal/microservices/transaction/delivery/http/handlers.go index 5b805fb3..1d7cb46d 100644 --- a/internal/microservices/transaction/delivery/http/handlers.go +++ b/internal/microservices/transaction/delivery/http/handlers.go @@ -64,7 +64,7 @@ func (h *Handler) GetCount(w http.ResponseWriter, r *http.Request) { // @Tags Transaction // @Description Get User all transaction // @Produce json -// @Param request query QueryListOptions false "Query Params" +// @Param request query models.QueryListOptions false "Query Params" // @Success 200 {object} Response[MasTransaction] "Show transaction" // @Success 204 {object} Response[string] "Show actual accounts" // @Failure 400 {object} ResponseError "Client error"