From 6fc2df3bf2122cc968683ede6ae42d0fbf18e9ca Mon Sep 17 00:00:00 2001 From: Taehoya Date: Sat, 2 Mar 2024 22:59:50 -0600 Subject: [PATCH] update swagger --- server/docs/docs.go | 122 +++++++++++++++++++++++++++++++++++++-- server/docs/swagger.json | 122 +++++++++++++++++++++++++++++++++++++-- server/docs/swagger.yaml | 84 +++++++++++++++++++++++++-- 3 files changed, 311 insertions(+), 17 deletions(-) diff --git a/server/docs/docs.go b/server/docs/docs.go index 1f24e91..264fa6b 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -416,6 +416,66 @@ const docTemplate = `{ } }, "/v1/trips/{id}": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "description": "get trip by id", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "trip" + ], + "summary": "get trip by id", + "parameters": [ + { + "type": "string", + "description": "Authorization", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.DetailedTripResponseDTO" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + } + } + }, "put": { "security": [ { @@ -669,6 +729,60 @@ const docTemplate = `{ } } }, + "dto.DetailedTripResponseDTO": { + "type": "object", + "required": [ + "countryProperty" + ], + "properties": { + "budget": { + "type": "number", + "example": 12345.12 + }, + "countryProperty": { + "$ref": "#/definitions/dto.CountryResponseDTO" + }, + "description": { + "type": "string", + "example": "sample-description" + }, + "endDateTime": { + "type": "string", + "example": "2024-01-02T15:04:05Z" + }, + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "sample-name" + }, + "noteProperty": { + "$ref": "#/definitions/dto.TripNoteProperty" + }, + "startDateTime": { + "type": "string", + "example": "2024-01-02T15:04:05Z" + }, + "top5Transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TransactionResponseDTO" + } + }, + "totalExpense": { + "type": "number", + "example": 100.12 + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TransactionResponseDTO" + } + } + } + }, "dto.ErrorResponseDTO": { "type": "object", "properties": { @@ -793,7 +907,7 @@ const docTemplate = `{ "properties": { "budget": { "type": "number", - "example": 2000.12 + "example": 2000.02 }, "countryId": { "type": "integer", @@ -828,15 +942,11 @@ const docTemplate = `{ "properties": { "budget": { "type": "number", - "example": 100.12 + "example": 12345.12 }, "countryProperty": { "$ref": "#/definitions/dto.CountryResponseDTO" }, - "description": { - "type": "string", - "example": "sample-description" - }, "endDateTime": { "type": "string", "example": "2024-01-02T15:04:05Z" diff --git a/server/docs/swagger.json b/server/docs/swagger.json index c9d8b68..42365a7 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -408,6 +408,66 @@ } }, "/v1/trips/{id}": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "description": "get trip by id", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "trip" + ], + "summary": "get trip by id", + "parameters": [ + { + "type": "string", + "description": "Authorization", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.DetailedTripResponseDTO" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/dto.ErrorResponseDTO" + } + } + } + }, "put": { "security": [ { @@ -661,6 +721,60 @@ } } }, + "dto.DetailedTripResponseDTO": { + "type": "object", + "required": [ + "countryProperty" + ], + "properties": { + "budget": { + "type": "number", + "example": 12345.12 + }, + "countryProperty": { + "$ref": "#/definitions/dto.CountryResponseDTO" + }, + "description": { + "type": "string", + "example": "sample-description" + }, + "endDateTime": { + "type": "string", + "example": "2024-01-02T15:04:05Z" + }, + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "sample-name" + }, + "noteProperty": { + "$ref": "#/definitions/dto.TripNoteProperty" + }, + "startDateTime": { + "type": "string", + "example": "2024-01-02T15:04:05Z" + }, + "top5Transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TransactionResponseDTO" + } + }, + "totalExpense": { + "type": "number", + "example": 100.12 + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TransactionResponseDTO" + } + } + } + }, "dto.ErrorResponseDTO": { "type": "object", "properties": { @@ -785,7 +899,7 @@ "properties": { "budget": { "type": "number", - "example": 2000.12 + "example": 2000.02 }, "countryId": { "type": "integer", @@ -820,15 +934,11 @@ "properties": { "budget": { "type": "number", - "example": 100.12 + "example": 12345.12 }, "countryProperty": { "$ref": "#/definitions/dto.CountryResponseDTO" }, - "description": { - "type": "string", - "example": "sample-description" - }, "endDateTime": { "type": "string", "example": "2024-01-02T15:04:05Z" diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index ee356b9..70c6451 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -21,6 +21,44 @@ definitions: example: Canada type: string type: object + dto.DetailedTripResponseDTO: + properties: + budget: + example: 12345.12 + type: number + countryProperty: + $ref: '#/definitions/dto.CountryResponseDTO' + description: + example: sample-description + type: string + endDateTime: + example: "2024-01-02T15:04:05Z" + type: string + id: + example: 1 + type: integer + name: + example: sample-name + type: string + noteProperty: + $ref: '#/definitions/dto.TripNoteProperty' + startDateTime: + example: "2024-01-02T15:04:05Z" + type: string + top5Transactions: + items: + $ref: '#/definitions/dto.TransactionResponseDTO' + type: array + totalExpense: + example: 100.12 + type: number + transactions: + items: + $ref: '#/definitions/dto.TransactionResponseDTO' + type: array + required: + - countryProperty + type: object dto.ErrorResponseDTO: properties: error_message: @@ -102,7 +140,7 @@ definitions: dto.TripRequestDTO: properties: budget: - example: 2000.12 + example: 2000.02 type: number countryId: example: 1 @@ -133,13 +171,10 @@ definitions: dto.TripResponseDTO: properties: budget: - example: 100.12 + example: 12345.12 type: number countryProperty: $ref: '#/definitions/dto.CountryResponseDTO' - description: - example: sample-description - type: string endDateTime: example: "2024-01-02T15:04:05Z" type: string @@ -492,6 +527,45 @@ paths: summary: delete trip tags: - trip + get: + consumes: + - application/json + description: get trip by id + parameters: + - description: Authorization + in: header + name: Authorization + required: true + type: string + - description: id + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/dto.DetailedTripResponseDTO' + "400": + description: Bad Request + schema: + $ref: '#/definitions/dto.ErrorResponseDTO' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/dto.ErrorResponseDTO' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/dto.ErrorResponseDTO' + security: + - bearer: [] + summary: get trip by id + tags: + - trip put: consumes: - application/json