merch-api/docs/swagger.json

1383 lines
47 KiB
JSON
Raw Permalink Normal View History

2026-03-01 22:15:10 +03:00
{
"swagger": "2.0",
"info": {
"description": "Stores data about merch and prices",
"title": "Merch API",
"contact": {},
"version": "2.3"
},
"basePath": "/api/v2",
"paths": {
2026-03-04 17:02:21 +03:00
"/merch/create": {
"post": {
"description": "Create new merch",
"consumes": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Create new merch",
"parameters": [
{
"description": "merch body",
"name": "merch",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.newMerchDTO"
}
}
],
"responses": {
"201": {
"description": "Created"
},
"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"
}
}
}
}
},
2026-03-07 15:50:05 +03:00
"/merch/extra/{uuid}": {
"put": {
"description": "Update ONLY merch extra data",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Update merch extra data",
"parameters": [
{
"type": "string",
"description": "merch uuid",
"name": "uuid",
"in": "path",
"required": true
},
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.extraDataDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/merch.extraDataDTO"
}
},
"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"
}
}
}
}
},
2026-03-13 16:55:14 +03:00
"/merch/labels": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Получить все метки товаров",
"produces": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Получить все метки товаров",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.LabelsList"
}
}
},
"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"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Создать новую метку для товара",
"consumes": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Создать новую метку для товара",
"parameters": [
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.LabelDTO"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
}
},
"/merch/labels/attach": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Прикрепить метку к товару",
"consumes": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Прикрепить метку к товару",
"parameters": [
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.LabelLink"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
}
},
"/merch/labels/detach": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Удалить привязку метки к товару",
"consumes": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Удалить привязку метки к товару",
"parameters": [
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.LabelLink"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
}
},
"/merch/labels/{uuid}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Получить метки товара по его uuid",
"produces": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Получить метки товара по его uuid",
"parameters": [
{
"type": "string",
"description": "label uuid",
"name": "uuid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Изменить метку",
"consumes": [
"application/json"
],
"tags": [
"Merch labels"
],
"summary": "Изменить метку",
"parameters": [
{
"type": "string",
"description": "label uuid",
"name": "uuid",
"in": "path",
"required": true
},
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.LabelDTO"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Пометить метку как удаленную",
"tags": [
"Merch labels"
],
"summary": "Пометить метку как удаленную",
"parameters": [
{
"type": "string",
"description": "label uuid",
"name": "uuid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"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"
}
}
}
}
},
2026-03-04 17:59:55 +03:00
"/merch/list": {
"get": {
"description": "Get all merch without origins",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Get all merch",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
2026-03-20 16:13:25 +03:00
"$ref": "#/definitions/merch.listResponse"
2026-03-04 17:59:55 +03:00
}
}
},
"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"
}
}
}
}
},
2026-03-01 22:15:10 +03:00
"/merch/origins": {
"get": {
"description": "Get all origins",
"produces": [
"application/json"
],
"tags": [
"Origins"
],
"summary": "Get all origins",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/merch.originsDTO"
}
},
"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"
}
}
}
},
"post": {
"description": "Create new origin with name",
"consumes": [
"application/json"
],
"tags": [
"Origins"
],
"summary": "Create new origin",
"parameters": [
{
"description": "origin body",
"name": "origin",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.newOriginDTO"
}
}
],
"responses": {
"201": {
"description": "Created"
},
"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"
}
}
}
},
"delete": {
"description": "Marks origin as deleted by name.",
"consumes": [
"application/json"
],
"tags": [
"Origins"
],
"summary": "Delete origin",
"parameters": [
{
"description": "origin body",
"name": "origin",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.deleteOriginDTO"
}
}
],
"responses": {
"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"
}
}
}
}
2026-03-04 17:59:55 +03:00
},
2026-03-11 20:17:40 +03:00
"/merch/zeroprices": {
"get": {
"description": "Получить нулевые цены",
"produces": [
"application/json"
],
"tags": [
"Merch zero prices"
],
"summary": "Получить нулевые цены",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.ZeroPrice"
}
}
},
"204": {
"description": "No Content"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/responses.Unauthorized"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/responses.InternalServerError"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Пометить нулевые цены как удаленные",
"consumes": [
"application/json"
],
"tags": [
"Merch zero prices"
],
"summary": "Пометить нулевые цены как удаленные",
"parameters": [
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.DeleteZeroPrices"
}
}
],
"responses": {
"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"
}
}
}
}
},
"/merch/zeroprices/period": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Пометить нулевые цены как удаленные за указанный период",
"tags": [
"Merch zero prices"
],
"summary": "Пометить нулевые цены как удаленные за указанный период",
"parameters": [
{
"type": "string",
"description": "start",
"name": "start",
"in": "query",
"required": true
},
{
"type": "string",
"description": "end",
"name": "end",
"in": "query",
"required": true
}
],
"responses": {
"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"
}
}
}
}
},
2026-03-04 17:59:55 +03:00
"/merch/{uuid}": {
2026-03-20 16:13:25 +03:00
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Получить всю информацию про мерч по его uuid",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Получить всю информацию про мерч",
"parameters": [
{
"type": "string",
"description": "merch_uuid",
"name": "uuid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/merch.singleMerchResponse"
}
},
"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"
}
}
}
},
2026-03-07 15:50:05 +03:00
"put": {
"description": "Update merch general info (except extra data)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Update merch",
"parameters": [
{
"type": "string",
"description": "merch uuid",
"name": "uuid",
"in": "path",
"required": true
},
{
"description": "payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/merch.updateMerchDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/merch.merchDTO"
}
},
"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"
}
}
}
},
2026-03-04 17:59:55 +03:00
"delete": {
"description": "Marks merch and all its extra data as deleted by uuid.",
"consumes": [
"application/json"
],
"tags": [
"Merch"
],
"summary": "Delete merch",
"parameters": [
{
"type": "string",
"description": "merch uuid",
"name": "uuid",
"in": "path",
"required": true
}
],
"responses": {
"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"
}
}
}
}
2026-03-10 23:44:59 +03:00
},
"/prices": {
"get": {
"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": {
"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"
}
}
}
}
2026-03-20 16:13:25 +03:00
},
"/user": {
"post": {
"description": "Adds local user record based on user uuid from auth service",
"consumes": [
"application/json"
],
"tags": [
"User"
],
"summary": "Create new user",
"responses": {
"201": {
"description": "Created"
},
"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"
}
}
}
},
"delete": {
"description": "Marks user as deleted by user uuid",
"consumes": [
"application/json"
],
"tags": [
"User"
],
"summary": "Delete user",
"responses": {
"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"
}
}
}
}
2026-03-01 22:15:10 +03:00
}
},
"definitions": {
2026-03-11 20:17:40 +03:00
"merch.DeleteZeroPrices": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"merch_uuid": {
"type": "string"
}
}
},
2026-03-13 16:55:14 +03:00
"merch.LabelDTO": {
"type": "object",
"properties": {
"bg_color": {
"type": "string"
},
"color": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"merch.LabelLink": {
"type": "object",
"properties": {
"label_uuid": {
"type": "string"
},
"merch_uuid": {
"type": "string"
}
}
},
"merch.LabelsList": {
"type": "object",
"properties": {
"bg_color": {
"type": "string"
},
"color": {
"type": "string"
},
"label_uuid": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
2026-03-10 23:44:59 +03:00
"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"
}
}
}
},
2026-03-11 20:17:40 +03:00
"merch.ZeroPrice": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
},
"origin": {
"type": "string"
}
}
},
2026-03-01 22:15:10 +03:00
"merch.deleteOriginDTO": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
2026-03-07 15:50:05 +03:00
"merch.extraDataDTO": {
"type": "object",
"properties": {
"links": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.originLink"
}
},
"merch_uuid": {
"type": "string"
}
}
},
2026-03-20 16:13:25 +03:00
"merch.listResponse": {
"type": "object",
"properties": {
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
2026-03-04 17:59:55 +03:00
"merch.merchDTO": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
2026-03-04 17:02:21 +03:00
"merch.newMerchDTO": {
"type": "object",
"properties": {
"links": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.originLink"
}
},
"name": {
"type": "string"
}
}
},
2026-03-01 22:15:10 +03:00
"merch.newOriginDTO": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"merch.originItem": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
2026-03-04 17:02:21 +03:00
"merch.originLink": {
"type": "object",
"properties": {
2026-03-07 15:50:05 +03:00
"origin": {
2026-03-04 17:02:21 +03:00
"type": "string"
},
2026-03-07 15:50:05 +03:00
"origin_link": {
2026-03-04 17:02:21 +03:00
"type": "string"
}
}
},
2026-03-01 22:15:10 +03:00
"merch.originsDTO": {
"type": "object",
"properties": {
"origins": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.originItem"
}
}
}
},
2026-03-20 16:13:25 +03:00
"merch.singleMerchResponse": {
"type": "object",
"properties": {
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
},
"origins": {
"type": "array",
"items": {
"$ref": "#/definitions/merch.originLink"
}
}
}
},
2026-03-07 15:50:05 +03:00
"merch.updateMerchDTO": {
"type": "object",
"properties": {
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
2026-03-01 22:15:10 +03:00
"responses.BadRequest": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "error"
}
}
},
"responses.InternalServerError": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "error"
}
}
},
"responses.Unauthorized": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "error"
}
}
}
}
}