diff --git a/docs/docs.go b/docs/docs.go index 19f48eb..7eac1a9 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -393,9 +393,166 @@ const docTemplate = `{ } } } + }, + "/prices": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Получить цены мерча за период", + "produces": [ + "application/json" + ], + "tags": [ + "Merch" + ], + "summary": "Получить цены мерча за период", + "parameters": [ + { + "type": "string", + "description": "period in days", + "name": "days", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.PricesResponse" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.BadRequest" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/responses.Unauthorized" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.InternalServerError" + } + } + } + } + }, + "/prices/{uuid}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Получить перепады цен мерча за период по его merch_uuid", + "produces": [ + "application/json" + ], + "tags": [ + "Merch" + ], + "summary": "Получить перепады цен мерча за период по его merch_uuid", + "parameters": [ + { + "type": "string", + "description": "merch_uuid", + "name": "uuid", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "period in days", + "name": "days", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/merch.PricesResponse" + } + }, + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.BadRequest" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/responses.Unauthorized" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.InternalServerError" + } + } + } + } } }, "definitions": { + "merch.OriginWithPrices": { + "type": "object", + "properties": { + "origin": { + "type": "string" + }, + "prices": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.PriceEntry" + } + } + } + }, + "merch.PriceEntry": { + "type": "object", + "properties": { + "created_at": { + "type": "integer" + }, + "value": { + "type": "integer" + } + } + }, + "merch.PricesResponse": { + "type": "object", + "properties": { + "merch_uuid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "origins": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.OriginWithPrices" + } + } + } + }, "merch.deleteOriginDTO": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index ac4db9a..80b6198 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -386,9 +386,166 @@ } } } + }, + "/prices": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Получить цены мерча за период", + "produces": [ + "application/json" + ], + "tags": [ + "Merch" + ], + "summary": "Получить цены мерча за период", + "parameters": [ + { + "type": "string", + "description": "period in days", + "name": "days", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.PricesResponse" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.BadRequest" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/responses.Unauthorized" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.InternalServerError" + } + } + } + } + }, + "/prices/{uuid}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Получить перепады цен мерча за период по его merch_uuid", + "produces": [ + "application/json" + ], + "tags": [ + "Merch" + ], + "summary": "Получить перепады цен мерча за период по его merch_uuid", + "parameters": [ + { + "type": "string", + "description": "merch_uuid", + "name": "uuid", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "period in days", + "name": "days", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/merch.PricesResponse" + } + }, + "204": { + "description": "No Content" + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/responses.BadRequest" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/responses.Unauthorized" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/responses.InternalServerError" + } + } + } + } } }, "definitions": { + "merch.OriginWithPrices": { + "type": "object", + "properties": { + "origin": { + "type": "string" + }, + "prices": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.PriceEntry" + } + } + } + }, + "merch.PriceEntry": { + "type": "object", + "properties": { + "created_at": { + "type": "integer" + }, + "value": { + "type": "integer" + } + } + }, + "merch.PricesResponse": { + "type": "object", + "properties": { + "merch_uuid": { + "type": "string" + }, + "name": { + "type": "string" + }, + "origins": { + "type": "array", + "items": { + "$ref": "#/definitions/merch.OriginWithPrices" + } + } + } + }, "merch.deleteOriginDTO": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 4b94e74..c0bd2eb 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,5 +1,32 @@ basePath: /api/v2 definitions: + merch.OriginWithPrices: + properties: + origin: + type: string + prices: + items: + $ref: '#/definitions/merch.PriceEntry' + type: array + type: object + merch.PriceEntry: + properties: + created_at: + type: integer + value: + type: integer + type: object + merch.PricesResponse: + properties: + merch_uuid: + type: string + name: + type: string + origins: + items: + $ref: '#/definitions/merch.OriginWithPrices' + type: array + type: object merch.deleteOriginDTO: properties: name: @@ -341,4 +368,77 @@ paths: summary: Create new origin tags: - Origins + /prices: + get: + description: Получить цены мерча за период + parameters: + - description: period in days + in: query + name: days + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/merch.PricesResponse' + type: array + "400": + description: Bad Request + schema: + $ref: '#/definitions/responses.BadRequest' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/responses.Unauthorized' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/responses.InternalServerError' + security: + - BearerAuth: [] + summary: Получить цены мерча за период + tags: + - Merch + /prices/{uuid}: + get: + description: Получить перепады цен мерча за период по его merch_uuid + parameters: + - description: merch_uuid + in: path + name: uuid + required: true + type: string + - description: period in days + in: query + name: days + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/merch.PricesResponse' + "204": + description: No Content + "400": + description: Bad Request + schema: + $ref: '#/definitions/responses.BadRequest' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/responses.Unauthorized' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/responses.InternalServerError' + security: + - BearerAuth: [] + summary: Получить перепады цен мерча за период по его merch_uuid + tags: + - Merch swagger: "2.0"