swagger docs update
This commit is contained in:
parent
9fe21b4b78
commit
e89efaa8b9
4 changed files with 1283 additions and 216 deletions
407
docs/docs.go
407
docs/docs.go
|
|
@ -120,6 +120,352 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/merch/list": {
|
"/merch/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get all merch without origins",
|
"description": "Get all merch without origins",
|
||||||
|
|
@ -136,7 +482,7 @@ const docTemplate = `{
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/merch.merchDTO"
|
"$ref": "#/definitions/merch.ListResponse"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -652,6 +998,65 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"merch.ListResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"labels": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"merch_uuid": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"merch.OriginWithPrices": {
|
"merch.OriginWithPrices": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,352 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/merch/list": {
|
"/merch/list": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get all merch without origins",
|
"description": "Get all merch without origins",
|
||||||
|
|
@ -129,7 +475,7 @@
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/merch.merchDTO"
|
"$ref": "#/definitions/merch.ListResponse"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -645,6 +991,65 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"merch.ListResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"labels": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"merch_uuid": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"merch.OriginWithPrices": {
|
"merch.OriginWithPrices": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,44 @@ definitions:
|
||||||
merch_uuid:
|
merch_uuid:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
merch.LabelDTO:
|
||||||
|
properties:
|
||||||
|
bg_color:
|
||||||
|
type: string
|
||||||
|
color:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
merch.LabelLink:
|
||||||
|
properties:
|
||||||
|
label_uuid:
|
||||||
|
type: string
|
||||||
|
merch_uuid:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
merch.LabelsList:
|
||||||
|
properties:
|
||||||
|
bg_color:
|
||||||
|
type: string
|
||||||
|
color:
|
||||||
|
type: string
|
||||||
|
label_uuid:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
merch.ListResponse:
|
||||||
|
properties:
|
||||||
|
labels:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
merch_uuid:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
merch.OriginWithPrices:
|
merch.OriginWithPrices:
|
||||||
properties:
|
properties:
|
||||||
origin:
|
origin:
|
||||||
|
|
@ -274,6 +312,225 @@ paths:
|
||||||
summary: Update merch extra data
|
summary: Update merch extra data
|
||||||
tags:
|
tags:
|
||||||
- Merch
|
- Merch
|
||||||
|
/merch/labels:
|
||||||
|
get:
|
||||||
|
description: Получить все метки товаров
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/merch.LabelsList'
|
||||||
|
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 labels
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Создать новую метку для товара
|
||||||
|
parameters:
|
||||||
|
- description: payload
|
||||||
|
in: body
|
||||||
|
name: payload
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Создать новую метку для товара
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
|
/merch/labels/{uuid}:
|
||||||
|
delete:
|
||||||
|
description: Пометить метку как удаленную
|
||||||
|
parameters:
|
||||||
|
- description: label uuid
|
||||||
|
in: path
|
||||||
|
name: uuid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Пометить метку как удаленную
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
|
get:
|
||||||
|
description: Получить метки товара по его uuid
|
||||||
|
parameters:
|
||||||
|
- description: label uuid
|
||||||
|
in: path
|
||||||
|
name: uuid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Получить метки товара по его uuid
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
|
put:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Изменить метку
|
||||||
|
parameters:
|
||||||
|
- description: label uuid
|
||||||
|
in: path
|
||||||
|
name: uuid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: payload
|
||||||
|
in: body
|
||||||
|
name: payload
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Изменить метку
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
|
/merch/labels/attach:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Прикрепить метку к товару
|
||||||
|
parameters:
|
||||||
|
- description: payload
|
||||||
|
in: body
|
||||||
|
name: payload
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Прикрепить метку к товару
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
|
/merch/labels/detach:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Удалить привязку метки к товару
|
||||||
|
parameters:
|
||||||
|
- description: payload
|
||||||
|
in: body
|
||||||
|
name: payload
|
||||||
|
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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Удалить привязку метки к товару
|
||||||
|
tags:
|
||||||
|
- Merch labels
|
||||||
/merch/list:
|
/merch/list:
|
||||||
get:
|
get:
|
||||||
description: Get all merch without origins
|
description: Get all merch without origins
|
||||||
|
|
@ -284,7 +541,7 @@ paths:
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/merch.merchDTO'
|
$ref: '#/definitions/merch.ListResponse'
|
||||||
type: array
|
type: array
|
||||||
"204":
|
"204":
|
||||||
description: No Content
|
description: No Content
|
||||||
|
|
|
||||||
|
|
@ -60,16 +60,16 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup) {
|
||||||
|
|
||||||
// create godoc
|
// create godoc
|
||||||
//
|
//
|
||||||
// @Summary Create new merch
|
// @Summary Create new merch
|
||||||
// @Description Create new merch
|
// @Description Create new merch
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param merch body newMerchDTO true "merch body"
|
// @Param merch body newMerchDTO true "merch body"
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/create [POST]
|
// @Router /merch/create [POST]
|
||||||
func (co *controller) create(c *gin.Context) {
|
func (co *controller) create(c *gin.Context) {
|
||||||
var newMerch newMerchDTO
|
var newMerch newMerchDTO
|
||||||
if err := c.ShouldBindJSON(&newMerch); err != nil {
|
if err := c.ShouldBindJSON(&newMerch); err != nil {
|
||||||
|
|
@ -91,16 +91,16 @@ func (co *controller) getOne(c *gin.Context) {}
|
||||||
|
|
||||||
// getMany godoc
|
// getMany godoc
|
||||||
//
|
//
|
||||||
// @Summary Get all merch
|
// @Summary Get all merch
|
||||||
// @Description Get all merch without origins
|
// @Description Get all merch without origins
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} ListResponse
|
// @Success 200 {array} ListResponse
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/list [GET]
|
// @Router /merch/list [GET]
|
||||||
func (co *controller) getMany(c *gin.Context) {
|
func (co *controller) getMany(c *gin.Context) {
|
||||||
response, err := co.service.getMany(c, getUserId(c))
|
response, err := co.service.getMany(c, getUserId(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -119,18 +119,18 @@ func (co *controller) getMany(c *gin.Context) {
|
||||||
|
|
||||||
// updateMerch godoc
|
// updateMerch godoc
|
||||||
//
|
//
|
||||||
// @Summary Update merch
|
// @Summary Update merch
|
||||||
// @Description Update merch general info (except extra data)
|
// @Description Update merch general info (except extra data)
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param uuid path string true "merch uuid"
|
// @Param uuid path string true "merch uuid"
|
||||||
// @Param payload body updateMerchDTO true "payload"
|
// @Param payload body updateMerchDTO true "payload"
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} merchDTO
|
// @Success 200 {object} merchDTO
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/{uuid} [PUT]
|
// @Router /merch/{uuid} [PUT]
|
||||||
func (co *controller) updateMerch(c *gin.Context) {
|
func (co *controller) updateMerch(c *gin.Context) {
|
||||||
merchUuid := c.Param("id")
|
merchUuid := c.Param("id")
|
||||||
if err := uuid.Validate(merchUuid); err != nil {
|
if err := uuid.Validate(merchUuid); err != nil {
|
||||||
|
|
@ -164,18 +164,18 @@ func (co *controller) updateMerch(c *gin.Context) {
|
||||||
|
|
||||||
// updateMerch godoc
|
// updateMerch godoc
|
||||||
//
|
//
|
||||||
// @Summary Update merch extra data
|
// @Summary Update merch extra data
|
||||||
// @Description Update ONLY merch extra data
|
// @Description Update ONLY merch extra data
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param uuid path string true "merch uuid"
|
// @Param uuid path string true "merch uuid"
|
||||||
// @Param payload body extraDataDTO true "payload"
|
// @Param payload body extraDataDTO true "payload"
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} extraDataDTO
|
// @Success 200 {object} extraDataDTO
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/extra/{uuid} [PUT]
|
// @Router /merch/extra/{uuid} [PUT]
|
||||||
func (co *controller) updateExtraData(c *gin.Context) {
|
func (co *controller) updateExtraData(c *gin.Context) {
|
||||||
merchUuid := c.Param("id")
|
merchUuid := c.Param("id")
|
||||||
if err := uuid.Validate(merchUuid); err != nil {
|
if err := uuid.Validate(merchUuid); err != nil {
|
||||||
|
|
@ -209,16 +209,16 @@ func (co *controller) updateExtraData(c *gin.Context) {
|
||||||
|
|
||||||
// deleteMerch godoc
|
// deleteMerch godoc
|
||||||
//
|
//
|
||||||
// @Summary Delete merch
|
// @Summary Delete merch
|
||||||
// @Description Marks merch and all its extra data as deleted by uuid.
|
// @Description Marks merch and all its extra data as deleted by uuid.
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param uuid path string true "merch uuid"
|
// @Param uuid path string true "merch uuid"
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/{uuid} [DELETE]
|
// @Router /merch/{uuid} [DELETE]
|
||||||
func (co *controller) deleteMerch(c *gin.Context) {
|
func (co *controller) deleteMerch(c *gin.Context) {
|
||||||
merchUuid := c.Param("id")
|
merchUuid := c.Param("id")
|
||||||
if err := uuid.Validate(merchUuid); err != nil {
|
if err := uuid.Validate(merchUuid); err != nil {
|
||||||
|
|
@ -238,16 +238,16 @@ func (co *controller) deleteMerch(c *gin.Context) {
|
||||||
|
|
||||||
// createOrigin godoc
|
// createOrigin godoc
|
||||||
//
|
//
|
||||||
// @Summary Create new origin
|
// @Summary Create new origin
|
||||||
// @Description Create new origin with name
|
// @Description Create new origin with name
|
||||||
// @Tags Origins
|
// @Tags Origins
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param origin body newOriginDTO true "origin body"
|
// @Param origin body newOriginDTO true "origin body"
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/origins [POST]
|
// @Router /merch/origins [POST]
|
||||||
func (co *controller) createOrigin(c *gin.Context) {
|
func (co *controller) createOrigin(c *gin.Context) {
|
||||||
var origin *newOriginDTO
|
var origin *newOriginDTO
|
||||||
|
|
||||||
|
|
@ -269,16 +269,16 @@ func (co *controller) createOrigin(c *gin.Context) {
|
||||||
|
|
||||||
// getOrigins godoc
|
// getOrigins godoc
|
||||||
//
|
//
|
||||||
// @Summary Get all origins
|
// @Summary Get all origins
|
||||||
// @Description Get all origins
|
// @Description Get all origins
|
||||||
// @Tags Origins
|
// @Tags Origins
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} originsDTO
|
// @Success 200 {object} originsDTO
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/origins [GET]
|
// @Router /merch/origins [GET]
|
||||||
func (co *controller) getOrigins(c *gin.Context) {
|
func (co *controller) getOrigins(c *gin.Context) {
|
||||||
response, err := co.service.getOrigins(c)
|
response, err := co.service.getOrigins(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -293,16 +293,16 @@ func (co *controller) getOrigins(c *gin.Context) {
|
||||||
|
|
||||||
// deleteOrigin godoc
|
// deleteOrigin godoc
|
||||||
//
|
//
|
||||||
// @Summary Delete origin
|
// @Summary Delete origin
|
||||||
// @Description Marks origin as deleted by name.
|
// @Description Marks origin as deleted by name.
|
||||||
// @Tags Origins
|
// @Tags Origins
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param origin body deleteOriginDTO true "origin body"
|
// @Param origin body deleteOriginDTO true "origin body"
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/origins [DELETE]
|
// @Router /merch/origins [DELETE]
|
||||||
func (co *controller) deleteOrigin(c *gin.Context) {
|
func (co *controller) deleteOrigin(c *gin.Context) {
|
||||||
var origin *deleteOriginDTO
|
var origin *deleteOriginDTO
|
||||||
|
|
||||||
|
|
@ -324,16 +324,16 @@ func (co *controller) deleteOrigin(c *gin.Context) {
|
||||||
|
|
||||||
// getChartsPrices godoc
|
// getChartsPrices godoc
|
||||||
//
|
//
|
||||||
// @Summary Получить цены мерча за период
|
// @Summary Получить цены мерча за период
|
||||||
// @Description Получить цены мерча за период
|
// @Description Получить цены мерча за период
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param days query string false "period in days"
|
// @Param days query string false "period in days"
|
||||||
// @Success 200 {array} PricesResponse
|
// @Success 200 {array} PricesResponse
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /prices [get]
|
// @Router /prices [get]
|
||||||
func (co *controller) getChartsPrices(c *gin.Context) {
|
func (co *controller) getChartsPrices(c *gin.Context) {
|
||||||
response, err := co.service.getPrices(c, getUserId(c), getDays(c))
|
response, err := co.service.getPrices(c, getUserId(c), getDays(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -347,18 +347,18 @@ func (co *controller) getChartsPrices(c *gin.Context) {
|
||||||
|
|
||||||
// getDistinctPrices godoc
|
// getDistinctPrices godoc
|
||||||
//
|
//
|
||||||
// @Summary Получить перепады цен мерча за период по его merch_uuid
|
// @Summary Получить перепады цен мерча за период по его merch_uuid
|
||||||
// @Description Получить перепады цен мерча за период по его merch_uuid
|
// @Description Получить перепады цен мерча за период по его merch_uuid
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param uuid path string true "merch_uuid"
|
// @Param uuid path string true "merch_uuid"
|
||||||
// @Param days query string false "period in days"
|
// @Param days query string false "period in days"
|
||||||
// @Success 200 {object} PricesResponse
|
// @Success 200 {object} PricesResponse
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /prices/{uuid} [get]
|
// @Router /prices/{uuid} [get]
|
||||||
func (co *controller) getDistinctPrices(c *gin.Context) {
|
func (co *controller) getDistinctPrices(c *gin.Context) {
|
||||||
merchUuid := c.Param("uuid")
|
merchUuid := c.Param("uuid")
|
||||||
if merchUuid == "" {
|
if merchUuid == "" {
|
||||||
|
|
@ -385,15 +385,15 @@ func (co *controller) getDistinctPrices(c *gin.Context) {
|
||||||
|
|
||||||
// getZeroPrices godoc
|
// getZeroPrices godoc
|
||||||
//
|
//
|
||||||
// @Summary Получить нулевые цены
|
// @Summary Получить нулевые цены
|
||||||
// @Description Получить нулевые цены
|
// @Description Получить нулевые цены
|
||||||
// @Tags Merch zero prices
|
// @Tags Merch zero prices
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} ZeroPrice
|
// @Success 200 {array} ZeroPrice
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/zeroprices [get]
|
// @Router /merch/zeroprices [get]
|
||||||
func (co *controller) getZeroPrices(c *gin.Context) {
|
func (co *controller) getZeroPrices(c *gin.Context) {
|
||||||
response, err := co.service.getZeroPrices(c, getUserId(c))
|
response, err := co.service.getZeroPrices(c, getUserId(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -411,17 +411,17 @@ func (co *controller) getZeroPrices(c *gin.Context) {
|
||||||
|
|
||||||
// deleteZeroPrices godoc
|
// deleteZeroPrices godoc
|
||||||
//
|
//
|
||||||
// @Summary Пометить нулевые цены как удаленные
|
// @Summary Пометить нулевые цены как удаленные
|
||||||
// @Description Пометить нулевые цены как удаленные
|
// @Description Пометить нулевые цены как удаленные
|
||||||
// @Tags Merch zero prices
|
// @Tags Merch zero prices
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param payload body DeleteZeroPrices true "payload"
|
// @Param payload body DeleteZeroPrices true "payload"
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/zeroprices [delete]
|
// @Router /merch/zeroprices [delete]
|
||||||
func (co *controller) deleteZeroPrices(c *gin.Context) {
|
func (co *controller) deleteZeroPrices(c *gin.Context) {
|
||||||
var payload []DeleteZeroPrices
|
var payload []DeleteZeroPrices
|
||||||
if err := c.ShouldBindJSON(&payload); err != nil {
|
if err := c.ShouldBindJSON(&payload); err != nil {
|
||||||
|
|
@ -446,17 +446,17 @@ func (co *controller) deleteZeroPrices(c *gin.Context) {
|
||||||
|
|
||||||
// deleteZeroPricesPeriod godoc
|
// deleteZeroPricesPeriod godoc
|
||||||
//
|
//
|
||||||
// @Summary Пометить нулевые цены как удаленные за указанный период
|
// @Summary Пометить нулевые цены как удаленные за указанный период
|
||||||
// @Description Пометить нулевые цены как удаленные за указанный период
|
// @Description Пометить нулевые цены как удаленные за указанный период
|
||||||
// @Tags Merch zero prices
|
// @Tags Merch zero prices
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Param start query string true "start"
|
// @Param start query string true "start"
|
||||||
// @Param end query string true "end"
|
// @Param end query string true "end"
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/zeroprices/period [delete]
|
// @Router /merch/zeroprices/period [delete]
|
||||||
func (co *controller) deleteZeroPricesPeriod(c *gin.Context) {
|
func (co *controller) deleteZeroPricesPeriod(c *gin.Context) {
|
||||||
start, err := co.utils.ParseTime(c.Query("start"))
|
start, err := co.utils.ParseTime(c.Query("start"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -482,17 +482,17 @@ func (co *controller) deleteZeroPricesPeriod(c *gin.Context) {
|
||||||
|
|
||||||
// createLabel godoc
|
// createLabel godoc
|
||||||
//
|
//
|
||||||
// @Summary Создать новую метку для товара
|
// @Summary Создать новую метку для товара
|
||||||
// @Description Создать новую метку для товара
|
// @Description Создать новую метку для товара
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param payload body LabelDTO true "payload"
|
// @Param payload body LabelDTO true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels [post]
|
// @Router /merch/labels [post]
|
||||||
func (co *controller) createLabel(c *gin.Context) {
|
func (co *controller) createLabel(c *gin.Context) {
|
||||||
var payload LabelDTO
|
var payload LabelDTO
|
||||||
if err := c.ShouldBindJSON(&payload); err != nil {
|
if err := c.ShouldBindJSON(&payload); err != nil {
|
||||||
|
|
@ -512,16 +512,16 @@ func (co *controller) createLabel(c *gin.Context) {
|
||||||
|
|
||||||
// getLabels godoc
|
// getLabels godoc
|
||||||
//
|
//
|
||||||
// @Summary Получить все метки товаров
|
// @Summary Получить все метки товаров
|
||||||
// @Description Получить все метки товаров
|
// @Description Получить все метки товаров
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} LabelsList
|
// @Success 200 {array} LabelsList
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels [get]
|
// @Router /merch/labels [get]
|
||||||
func (co *controller) getLabels(c *gin.Context) {
|
func (co *controller) getLabels(c *gin.Context) {
|
||||||
response, err := co.service.getLabels(c, getUserId(c))
|
response, err := co.service.getLabels(c, getUserId(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -535,18 +535,18 @@ func (co *controller) getLabels(c *gin.Context) {
|
||||||
|
|
||||||
// updateLabel godoc
|
// updateLabel godoc
|
||||||
//
|
//
|
||||||
// @Summary Изменить метку
|
// @Summary Изменить метку
|
||||||
// @Description Изменить метку
|
// @Description Изменить метку
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param uuid path string true "label uuid"
|
// @Param uuid path string true "label uuid"
|
||||||
// @Param payload body LabelDTO true "payload"
|
// @Param payload body LabelDTO true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels/{uuid} [put]
|
// @Router /merch/labels/{uuid} [put]
|
||||||
func (co *controller) updateLabel(c *gin.Context) {
|
func (co *controller) updateLabel(c *gin.Context) {
|
||||||
labelUuid := c.Param("uuid")
|
labelUuid := c.Param("uuid")
|
||||||
if labelUuid == "" {
|
if labelUuid == "" {
|
||||||
|
|
@ -573,16 +573,16 @@ func (co *controller) updateLabel(c *gin.Context) {
|
||||||
|
|
||||||
// deleteLabel godoc
|
// deleteLabel godoc
|
||||||
//
|
//
|
||||||
// @Summary Пометить метку как удаленную
|
// @Summary Пометить метку как удаленную
|
||||||
// @Description Пометить метку как удаленную
|
// @Description Пометить метку как удаленную
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Param uuid path string true "label uuid"
|
// @Param uuid path string true "label uuid"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels/{uuid} [delete]
|
// @Router /merch/labels/{uuid} [delete]
|
||||||
func (co *controller) deleteLabel(c *gin.Context) {
|
func (co *controller) deleteLabel(c *gin.Context) {
|
||||||
labelUuid := c.Param("uuid")
|
labelUuid := c.Param("uuid")
|
||||||
if labelUuid == "" {
|
if labelUuid == "" {
|
||||||
|
|
@ -602,17 +602,17 @@ func (co *controller) deleteLabel(c *gin.Context) {
|
||||||
|
|
||||||
// attachLabel godoc
|
// attachLabel godoc
|
||||||
//
|
//
|
||||||
// @Summary Прикрепить метку к товару
|
// @Summary Прикрепить метку к товару
|
||||||
// @Description Прикрепить метку к товару
|
// @Description Прикрепить метку к товару
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param payload body LabelLink true "payload"
|
// @Param payload body LabelLink true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels/attach [post]
|
// @Router /merch/labels/attach [post]
|
||||||
func (co *controller) attachLabel(c *gin.Context) {
|
func (co *controller) attachLabel(c *gin.Context) {
|
||||||
var payload LabelLink
|
var payload LabelLink
|
||||||
if err := c.ShouldBindJSON(&payload); err != nil {
|
if err := c.ShouldBindJSON(&payload); err != nil {
|
||||||
|
|
@ -631,17 +631,17 @@ func (co *controller) attachLabel(c *gin.Context) {
|
||||||
|
|
||||||
// detachLabel godoc
|
// detachLabel godoc
|
||||||
//
|
//
|
||||||
// @Summary Удалить привязку метки к товару
|
// @Summary Удалить привязку метки к товару
|
||||||
// @Description Удалить привязку метки к товару
|
// @Description Удалить привязку метки к товару
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param payload body LabelLink true "payload"
|
// @Param payload body LabelLink true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels/detach [post]
|
// @Router /merch/labels/detach [post]
|
||||||
func (co *controller) detachLabel(c *gin.Context) {
|
func (co *controller) detachLabel(c *gin.Context) {
|
||||||
var payload LabelLink
|
var payload LabelLink
|
||||||
if err := c.ShouldBindJSON(&payload); err != nil {
|
if err := c.ShouldBindJSON(&payload); err != nil {
|
||||||
|
|
@ -661,17 +661,17 @@ func (co *controller) detachLabel(c *gin.Context) {
|
||||||
|
|
||||||
// getMerchLabels godoc
|
// getMerchLabels godoc
|
||||||
//
|
//
|
||||||
// @Summary Получить метки товара по его uuid
|
// @Summary Получить метки товара по его uuid
|
||||||
// @Description Получить метки товара по его uuid
|
// @Description Получить метки товара по его uuid
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param uuid path string true "label uuid"
|
// @Param uuid path string true "label uuid"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.BadRequest
|
// @Failure 400 {object} responses.BadRequest
|
||||||
// @Failure 401 {object} responses.Unauthorized
|
// @Failure 401 {object} responses.Unauthorized
|
||||||
// @Failure 500 {object} responses.InternalServerError
|
// @Failure 500 {object} responses.InternalServerError
|
||||||
// @Router /merch/labels/{uuid} [get]
|
// @Router /merch/labels/{uuid} [get]
|
||||||
func (co *controller) getMerchLabels(c *gin.Context) {
|
func (co *controller) getMerchLabels(c *gin.Context) {
|
||||||
merchUuid := c.Param("uuid")
|
merchUuid := c.Param("uuid")
|
||||||
if merchUuid == "" {
|
if merchUuid == "" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue