Skip to content

Commit

Permalink
update swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyKomarovCoder committed Nov 22, 2023
1 parent 0ee98e7 commit ea13592
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 36 deletions.
99 changes: 87 additions & 12 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
],
Expand Down Expand Up @@ -1127,9 +1186,6 @@ const docTemplate = `{
"http.MasTransaction": {
"type": "object",
"properties": {
"is_all": {
"type": "boolean"
},
"transactions": {
"type": "array",
"items": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -1342,6 +1409,14 @@ const docTemplate = `{
}
}
},
"http.TransactionCount": {
"type": "object",
"properties": {
"count": {
"type": "integer"
}
}
},
"http.TransactionCreateResponse": {
"type": "object",
"properties": {
Expand Down
99 changes: 87 additions & 12 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
],
Expand Down Expand Up @@ -1121,9 +1180,6 @@
"http.MasTransaction": {
"type": "object",
"properties": {
"is_all": {
"type": "boolean"
},
"transactions": {
"type": "array",
"items": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -1336,6 +1403,14 @@
}
}
},
"http.TransactionCount": {
"type": "object",
"properties": {
"count": {
"type": "integer"
}
}
},
"http.TransactionCreateResponse": {
"type": "object",
"properties": {
Expand Down
70 changes: 59 additions & 11 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ definitions:
type: object
http.MasTransaction:
properties:
is_all:
type: boolean
transactions:
items:
$ref: '#/definitions/models.TransactionTransfer'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -194,6 +199,11 @@ definitions:
status:
type: integer
type: object
http.TransactionCount:
properties:
count:
type: integer
type: object
http.TransactionCreateResponse:
properties:
transaction_id:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ea13592

Please sign in to comment.