Compare commits
No commits in common. "main" and "v0.1.21" have entirely different histories.
17 changed files with 305 additions and 1383 deletions
416
docs/docs.go
416
docs/docs.go
|
|
@ -15,88 +15,7 @@ const docTemplate = `{
|
||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/merch/": {
|
"/merch": {
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Получить все записи мерча",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch"
|
|
||||||
],
|
|
||||||
"summary": "Получить все записи мерча",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/merch.ListResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Обновить информацию про мерч по его uuid в json-е",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch"
|
|
||||||
],
|
|
||||||
"summary": "Обновить информацию про мерч",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "merch_uuid",
|
|
||||||
"name": "body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/merch.UpdateMerchDTO"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -141,6 +60,83 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/merch/": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Получить все записи мерча",
|
||||||
|
"tags": [
|
||||||
|
"Merch"
|
||||||
|
],
|
||||||
|
"summary": "Получить все записи мерча",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/merch.ListResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Обновить информацию про мерч по его uuid в json-е",
|
||||||
|
"tags": [
|
||||||
|
"Merch"
|
||||||
|
],
|
||||||
|
"summary": "Обновить информацию про мерч",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "merch_uuid",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/merch.UpdateMerchDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/merch/images/{uuid}": {
|
"/merch/images/{uuid}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -149,9 +145,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить картинки по merch_uuid и query параметрам",
|
"description": "Получить картинки по merch_uuid и query параметрам",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch images"
|
"Merch images"
|
||||||
],
|
],
|
||||||
|
|
@ -294,9 +287,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить все метки товаров",
|
"description": "Получить все метки товаров",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -332,9 +322,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Создать новую метку для товара",
|
"description": "Создать новую метку для товара",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -377,9 +364,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Прикрепить метку к товару",
|
"description": "Прикрепить метку к товару",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -422,9 +406,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Удалить привязку метки к товару",
|
"description": "Удалить привязку метки к товару",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -460,47 +441,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/merch/labels/{uuid}": {
|
"/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.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
"put": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -508,9 +448,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Изменить метку",
|
"description": "Изменить метку",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -590,136 +527,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/merch/zeroprices": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Получить нулевые цены",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch zero prices"
|
|
||||||
],
|
|
||||||
"summary": "Получить нулевые цены",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/merch.ZeroPrice"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"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": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/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": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/merch/{uuid}": {
|
"/merch/{uuid}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -728,9 +535,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить всю информацию про мерч по его uuid",
|
"description": "Получить всю информацию про мерч по его uuid",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -815,9 +619,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить цены мерча за период",
|
"description": "Получить цены мерча за период",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -863,9 +664,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить перепады цен мерча за период по его merch_uuid",
|
"description": "Получить перепады цен мерча за период по его merch_uuid",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -1220,25 +1018,6 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"merch.AmiamiDTO": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"link": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch.DeleteZeroPrices": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch.ImageLink": {
|
"merch.ImageLink": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -1295,12 +1074,6 @@ const docTemplate = `{
|
||||||
"merch.ListResponse": {
|
"merch.ListResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"labels": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
"merch_uuid": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -1320,21 +1093,12 @@ const docTemplate = `{
|
||||||
"merch.MerchDTO": {
|
"merch.MerchDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"labels": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
"merch_uuid": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"origin_amiami": {
|
|
||||||
"$ref": "#/definitions/merch.AmiamiDTO"
|
|
||||||
},
|
|
||||||
"origin_mandarake": {
|
"origin_mandarake": {
|
||||||
"$ref": "#/definitions/merch.MandarakeDTO"
|
"$ref": "#/definitions/merch.MandarakeDTO"
|
||||||
},
|
},
|
||||||
|
|
@ -1346,7 +1110,7 @@ const docTemplate = `{
|
||||||
"merch.OriginWithPrices": {
|
"merch.OriginWithPrices": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"origins": {
|
"origin": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
|
|
@ -1405,31 +1169,11 @@ const docTemplate = `{
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"origins": {
|
"origin": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"merch.ZeroPrice": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"created_at": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"origins": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses.ErrorResponse400": {
|
"responses.ErrorResponse400": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -7,88 +7,7 @@
|
||||||
},
|
},
|
||||||
"basePath": "/api/v2",
|
"basePath": "/api/v2",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/merch/": {
|
"/merch": {
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Получить все записи мерча",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch"
|
|
||||||
],
|
|
||||||
"summary": "Получить все записи мерча",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/merch.ListResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Обновить информацию про мерч по его uuid в json-е",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch"
|
|
||||||
],
|
|
||||||
"summary": "Обновить информацию про мерч",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "merch_uuid",
|
|
||||||
"name": "body",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/merch.UpdateMerchDTO"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -133,6 +52,83 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/merch/": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Получить все записи мерча",
|
||||||
|
"tags": [
|
||||||
|
"Merch"
|
||||||
|
],
|
||||||
|
"summary": "Получить все записи мерча",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/merch.ListResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Обновить информацию про мерч по его uuid в json-е",
|
||||||
|
"tags": [
|
||||||
|
"Merch"
|
||||||
|
],
|
||||||
|
"summary": "Обновить информацию про мерч",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "merch_uuid",
|
||||||
|
"name": "body",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/merch.UpdateMerchDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse400"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/responses.ErrorResponse500"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/merch/images/{uuid}": {
|
"/merch/images/{uuid}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -141,9 +137,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить картинки по merch_uuid и query параметрам",
|
"description": "Получить картинки по merch_uuid и query параметрам",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch images"
|
"Merch images"
|
||||||
],
|
],
|
||||||
|
|
@ -286,9 +279,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить все метки товаров",
|
"description": "Получить все метки товаров",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -324,9 +314,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Создать новую метку для товара",
|
"description": "Создать новую метку для товара",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -369,9 +356,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Прикрепить метку к товару",
|
"description": "Прикрепить метку к товару",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -414,9 +398,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Удалить привязку метки к товару",
|
"description": "Удалить привязку метки к товару",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -452,47 +433,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/merch/labels/{uuid}": {
|
"/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.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"put": {
|
"put": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
|
@ -500,9 +440,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Изменить метку",
|
"description": "Изменить метку",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch labels"
|
"Merch labels"
|
||||||
],
|
],
|
||||||
|
|
@ -582,136 +519,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/merch/zeroprices": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"BearerAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Получить нулевые цены",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"Merch zero prices"
|
|
||||||
],
|
|
||||||
"summary": "Получить нулевые цены",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/merch.ZeroPrice"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"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": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/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": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK"
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Bad Request",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse400"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal Server Error",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/responses.ErrorResponse500"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/merch/{uuid}": {
|
"/merch/{uuid}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|
@ -720,9 +527,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить всю информацию про мерч по его uuid",
|
"description": "Получить всю информацию про мерч по его uuid",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -807,9 +611,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить цены мерча за период",
|
"description": "Получить цены мерча за период",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -855,9 +656,6 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Получить перепады цен мерча за период по его merch_uuid",
|
"description": "Получить перепады цен мерча за период по его merch_uuid",
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"Merch"
|
"Merch"
|
||||||
],
|
],
|
||||||
|
|
@ -1212,25 +1010,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"merch.AmiamiDTO": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"link": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch.DeleteZeroPrices": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch.ImageLink": {
|
"merch.ImageLink": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -1287,12 +1066,6 @@
|
||||||
"merch.ListResponse": {
|
"merch.ListResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"labels": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
"merch_uuid": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -1312,21 +1085,12 @@
|
||||||
"merch.MerchDTO": {
|
"merch.MerchDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"labels": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
"merch_uuid": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"origin_amiami": {
|
|
||||||
"$ref": "#/definitions/merch.AmiamiDTO"
|
|
||||||
},
|
|
||||||
"origin_mandarake": {
|
"origin_mandarake": {
|
||||||
"$ref": "#/definitions/merch.MandarakeDTO"
|
"$ref": "#/definitions/merch.MandarakeDTO"
|
||||||
},
|
},
|
||||||
|
|
@ -1338,7 +1102,7 @@
|
||||||
"merch.OriginWithPrices": {
|
"merch.OriginWithPrices": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"origins": {
|
"origin": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"prices": {
|
"prices": {
|
||||||
|
|
@ -1397,31 +1161,11 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"origins": {
|
"origin": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"merch.ZeroPrice": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"created_at": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"merch_uuid": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"origins": {
|
|
||||||
"type": "integer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"responses.ErrorResponse400": {
|
"responses.ErrorResponse400": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,6 @@ definitions:
|
||||||
thumbnail:
|
thumbnail:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
merch.AmiamiDTO:
|
|
||||||
properties:
|
|
||||||
link:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
merch.DeleteZeroPrices:
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
merch_uuid:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
merch.ImageLink:
|
merch.ImageLink:
|
||||||
properties:
|
properties:
|
||||||
etag:
|
etag:
|
||||||
|
|
@ -55,10 +43,6 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
merch.ListResponse:
|
merch.ListResponse:
|
||||||
properties:
|
properties:
|
||||||
labels:
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
type: array
|
|
||||||
merch_uuid:
|
merch_uuid:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
|
|
@ -71,16 +55,10 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
merch.MerchDTO:
|
merch.MerchDTO:
|
||||||
properties:
|
properties:
|
||||||
labels:
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
type: array
|
|
||||||
merch_uuid:
|
merch_uuid:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
origin_amiami:
|
|
||||||
$ref: '#/definitions/merch.AmiamiDTO'
|
|
||||||
origin_mandarake:
|
origin_mandarake:
|
||||||
$ref: '#/definitions/merch.MandarakeDTO'
|
$ref: '#/definitions/merch.MandarakeDTO'
|
||||||
origin_surugaya:
|
origin_surugaya:
|
||||||
|
|
@ -88,7 +66,7 @@ definitions:
|
||||||
type: object
|
type: object
|
||||||
merch.OriginWithPrices:
|
merch.OriginWithPrices:
|
||||||
properties:
|
properties:
|
||||||
origins:
|
origin:
|
||||||
type: integer
|
type: integer
|
||||||
prices:
|
prices:
|
||||||
items:
|
items:
|
||||||
|
|
@ -126,22 +104,9 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
origins:
|
origin:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
merch.ZeroPrice:
|
|
||||||
properties:
|
|
||||||
created_at:
|
|
||||||
type: string
|
|
||||||
id:
|
|
||||||
type: integer
|
|
||||||
merch_uuid:
|
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
origins:
|
|
||||||
type: integer
|
|
||||||
type: object
|
|
||||||
responses.ErrorResponse400:
|
responses.ErrorResponse400:
|
||||||
properties:
|
properties:
|
||||||
error:
|
error:
|
||||||
|
|
@ -209,31 +174,7 @@ info:
|
||||||
title: Merch Parser
|
title: Merch Parser
|
||||||
version: 2.0.0-alpha
|
version: 2.0.0-alpha
|
||||||
paths:
|
paths:
|
||||||
/merch/:
|
/merch:
|
||||||
get:
|
|
||||||
description: Получить все записи мерча
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/merch.ListResponse'
|
|
||||||
type: array
|
|
||||||
"400":
|
|
||||||
description: Bad Request
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse400'
|
|
||||||
"500":
|
|
||||||
description: Internal Server Error
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse500'
|
|
||||||
security:
|
|
||||||
- BearerAuth: []
|
|
||||||
summary: Получить все записи мерча
|
|
||||||
tags:
|
|
||||||
- Merch
|
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
@ -261,9 +202,30 @@ paths:
|
||||||
summary: Добавить новый мерч
|
summary: Добавить новый мерч
|
||||||
tags:
|
tags:
|
||||||
- Merch
|
- Merch
|
||||||
|
/merch/:
|
||||||
|
get:
|
||||||
|
description: Получить все записи мерча
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/merch.ListResponse'
|
||||||
|
type: array
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/responses.ErrorResponse400'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/responses.ErrorResponse500'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Получить все записи мерча
|
||||||
|
tags:
|
||||||
|
- Merch
|
||||||
put:
|
put:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Обновить информацию про мерч по его uuid в json-е
|
description: Обновить информацию про мерч по его uuid в json-е
|
||||||
parameters:
|
parameters:
|
||||||
- description: merch_uuid
|
- description: merch_uuid
|
||||||
|
|
@ -323,8 +285,6 @@ paths:
|
||||||
name: uuid
|
name: uuid
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
@ -381,8 +341,6 @@ paths:
|
||||||
name: type
|
name: type
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
@ -440,8 +398,6 @@ paths:
|
||||||
/merch/labels:
|
/merch/labels:
|
||||||
get:
|
get:
|
||||||
description: Получить все метки товаров
|
description: Получить все метки товаров
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
@ -463,8 +419,6 @@ paths:
|
||||||
tags:
|
tags:
|
||||||
- Merch labels
|
- Merch labels
|
||||||
post:
|
post:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Создать новую метку для товара
|
description: Создать новую метку для товара
|
||||||
parameters:
|
parameters:
|
||||||
- description: payload
|
- description: payload
|
||||||
|
|
@ -514,35 +468,7 @@ paths:
|
||||||
summary: Пометить метку как удаленную
|
summary: Пометить метку как удаленную
|
||||||
tags:
|
tags:
|
||||||
- Merch labels
|
- 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.ErrorResponse400'
|
|
||||||
"500":
|
|
||||||
description: Internal Server Error
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse500'
|
|
||||||
security:
|
|
||||||
- BearerAuth: []
|
|
||||||
summary: Получить метки товара по его uuid
|
|
||||||
tags:
|
|
||||||
- Merch labels
|
|
||||||
put:
|
put:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Изменить метку
|
description: Изменить метку
|
||||||
parameters:
|
parameters:
|
||||||
- description: label uuid
|
- description: label uuid
|
||||||
|
|
@ -574,8 +500,6 @@ paths:
|
||||||
- Merch labels
|
- Merch labels
|
||||||
/merch/labels/attach:
|
/merch/labels/attach:
|
||||||
post:
|
post:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Прикрепить метку к товару
|
description: Прикрепить метку к товару
|
||||||
parameters:
|
parameters:
|
||||||
- description: payload
|
- description: payload
|
||||||
|
|
@ -602,8 +526,6 @@ paths:
|
||||||
- Merch labels
|
- Merch labels
|
||||||
/merch/labels/detach:
|
/merch/labels/detach:
|
||||||
post:
|
post:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Удалить привязку метки к товару
|
description: Удалить привязку метки к товару
|
||||||
parameters:
|
parameters:
|
||||||
- description: payload
|
- description: payload
|
||||||
|
|
@ -628,88 +550,6 @@ paths:
|
||||||
summary: Удалить привязку метки к товару
|
summary: Удалить привязку метки к товару
|
||||||
tags:
|
tags:
|
||||||
- Merch labels
|
- Merch labels
|
||||||
/merch/zeroprices:
|
|
||||||
delete:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Пометить нулевые цены как удаленные
|
|
||||||
parameters:
|
|
||||||
- description: payload
|
|
||||||
in: body
|
|
||||||
name: payload
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/merch.DeleteZeroPrices'
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
"400":
|
|
||||||
description: Bad Request
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse400'
|
|
||||||
"500":
|
|
||||||
description: Internal Server Error
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse500'
|
|
||||||
security:
|
|
||||||
- BearerAuth: []
|
|
||||||
summary: Пометить нулевые цены как удаленные
|
|
||||||
tags:
|
|
||||||
- Merch zero prices
|
|
||||||
get:
|
|
||||||
description: Получить нулевые цены
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/merch.ZeroPrice'
|
|
||||||
type: array
|
|
||||||
"400":
|
|
||||||
description: Bad Request
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse400'
|
|
||||||
"500":
|
|
||||||
description: Internal Server Error
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse500'
|
|
||||||
security:
|
|
||||||
- BearerAuth: []
|
|
||||||
summary: Получить нулевые цены
|
|
||||||
tags:
|
|
||||||
- Merch zero prices
|
|
||||||
/merch/zeroprices/period:
|
|
||||||
delete:
|
|
||||||
description: Пометить нулевые цены как удаленные за указанный период
|
|
||||||
parameters:
|
|
||||||
- description: start
|
|
||||||
in: query
|
|
||||||
name: start
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
- description: end
|
|
||||||
in: query
|
|
||||||
name: end
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
"400":
|
|
||||||
description: Bad Request
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse400'
|
|
||||||
"500":
|
|
||||||
description: Internal Server Error
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/responses.ErrorResponse500'
|
|
||||||
security:
|
|
||||||
- BearerAuth: []
|
|
||||||
summary: Пометить нулевые цены как удаленные за указанный период
|
|
||||||
tags:
|
|
||||||
- Merch zero prices
|
|
||||||
/prices:
|
/prices:
|
||||||
get:
|
get:
|
||||||
description: Получить цены мерча за период
|
description: Получить цены мерча за период
|
||||||
|
|
@ -718,8 +558,6 @@ paths:
|
||||||
in: query
|
in: query
|
||||||
name: days
|
name: days
|
||||||
type: string
|
type: string
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
@ -753,8 +591,6 @@ paths:
|
||||||
in: query
|
in: query
|
||||||
name: days
|
name: days
|
||||||
type: string
|
type: string
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ func newController(service *service, utils interfaces.Utils, expires time.Durati
|
||||||
|
|
||||||
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
|
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
|
||||||
merchGroup := r.Group("/merch", authMW)
|
merchGroup := r.Group("/merch", authMW)
|
||||||
|
|
||||||
merchGroup.POST("/", h.controller.addMerch)
|
merchGroup.POST("/", h.controller.addMerch)
|
||||||
merchGroup.GET("/:uuid", h.controller.getSingleMerch)
|
merchGroup.GET("/:uuid", h.controller.getSingleMerch)
|
||||||
merchGroup.GET("/", h.controller.getAllMerch)
|
merchGroup.GET("/", h.controller.getAllMerch)
|
||||||
|
|
@ -50,13 +51,6 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, ref
|
||||||
labelsGroup.POST("/attach", h.controller.attachLabel)
|
labelsGroup.POST("/attach", h.controller.attachLabel)
|
||||||
labelsGroup.POST("/detach", h.controller.detachLabel)
|
labelsGroup.POST("/detach", h.controller.detachLabel)
|
||||||
labelsGroup.GET("/:uuid", h.controller.getMerchLabels)
|
labelsGroup.GET("/:uuid", h.controller.getMerchLabels)
|
||||||
|
|
||||||
zeroPricesGroup := merchGroup.Group("/zeroprices", authMW)
|
|
||||||
zeroPricesGroup.GET("", h.controller.getZeroPrices)
|
|
||||||
zeroPricesGroup.DELETE("", h.controller.deleteZeroPrices)
|
|
||||||
|
|
||||||
zeroPricesGroup.DELETE("/period", h.controller.deleteZeroPricesPeriod)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Добавить новый мерч
|
// @Summary Добавить новый мерч
|
||||||
|
|
@ -68,7 +62,7 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, ref
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
// @Router /merch/ [post]
|
// @Router /merch [post]
|
||||||
func (co *controller) addMerch(c *gin.Context) {
|
func (co *controller) addMerch(c *gin.Context) {
|
||||||
var payload MerchDTO
|
var payload MerchDTO
|
||||||
if err := c.ShouldBind(&payload); err != nil {
|
if err := c.ShouldBind(&payload); err != nil {
|
||||||
|
|
@ -98,7 +92,6 @@ func (co *controller) addMerch(c *gin.Context) {
|
||||||
// @Description Получить всю информацию про мерч по его uuid
|
// @Description Получить всю информацию про мерч по его uuid
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
|
||||||
// @Param uuid path string true "merch_uuid"
|
// @Param uuid path string true "merch_uuid"
|
||||||
// @Success 200 {object} MerchDTO
|
// @Success 200 {object} MerchDTO
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -132,7 +125,6 @@ func (co *controller) getSingleMerch(c *gin.Context) {
|
||||||
// @Description Получить все записи мерча
|
// @Description Получить все записи мерча
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {array} ListResponse
|
// @Success 200 {array} ListResponse
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
|
|
@ -159,7 +151,6 @@ func (co *controller) getAllMerch(c *gin.Context) {
|
||||||
// @Description Обновить информацию про мерч по его uuid в json-е
|
// @Description Обновить информацию про мерч по его uuid в json-е
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
|
||||||
// @Param body body UpdateMerchDTO true "merch_uuid"
|
// @Param body body UpdateMerchDTO true "merch_uuid"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -185,7 +176,6 @@ func (co *controller) updateMerch(c *gin.Context) {
|
||||||
log.WithError(err).Error("Merch | Failed to get single merch")
|
log.WithError(err).Error("Merch | Failed to get single merch")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Status(http.StatusOK)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Пометить мерч как удаленный
|
// @Summary Пометить мерч как удаленный
|
||||||
|
|
@ -196,7 +186,6 @@ func (co *controller) updateMerch(c *gin.Context) {
|
||||||
// @Success 200 {object} MerchDTO
|
// @Success 200 {object} MerchDTO
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
//
|
|
||||||
// @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("uuid")
|
merchUuid := c.Param("uuid")
|
||||||
|
|
@ -225,7 +214,6 @@ func (co *controller) deleteMerch(c *gin.Context) {
|
||||||
// @Description Получить цены мерча за период
|
// @Description Получить цены мерча за период
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @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.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -255,7 +243,6 @@ func (co *controller) getChartsPrices(c *gin.Context) {
|
||||||
// @Description Получить перепады цен мерча за период по его merch_uuid
|
// @Description Получить перепады цен мерча за период по его merch_uuid
|
||||||
// @Tags Merch
|
// @Tags Merch
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @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
|
||||||
|
|
@ -343,6 +330,7 @@ func (co *controller) uploadMerchImage(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//c.Status(http.StatusOK)
|
||||||
c.JSON(http.StatusOK, response)
|
c.JSON(http.StatusOK, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,7 +338,6 @@ func (co *controller) uploadMerchImage(c *gin.Context) {
|
||||||
// @Description Получить картинки по merch_uuid и query параметрам
|
// @Description Получить картинки по merch_uuid и query параметрам
|
||||||
// @Tags Merch images
|
// @Tags Merch images
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
|
||||||
// @Param uuid path string true "merch_uuid"
|
// @Param uuid path string true "merch_uuid"
|
||||||
// @Param type query string true "image type"
|
// @Param type query string true "image type"
|
||||||
// @Success 200 {object} ImageLink
|
// @Success 200 {object} ImageLink
|
||||||
|
|
@ -397,6 +384,7 @@ func (co *controller) getMerchImage(c *gin.Context) {
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//c.JSON(http.StatusOK, link)
|
//c.JSON(http.StatusOK, link)
|
||||||
|
c.JSON(http.StatusNotImplemented, gin.H{"msg": "Method deprecated. Request images from image storage."})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Удалить (безвозвратно) картинки по merch_uuid
|
// @Summary Удалить (безвозвратно) картинки по merch_uuid
|
||||||
|
|
@ -441,7 +429,6 @@ func (co *controller) deleteMerchImage(c *gin.Context) {
|
||||||
// @Description Создать новую метку для товара
|
// @Description Создать новую метку для товара
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
|
||||||
// @Param payload body LabelDTO true "payload"
|
// @Param payload body LabelDTO true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -477,7 +464,6 @@ func (co *controller) createLabel(c *gin.Context) {
|
||||||
// @Description Получить все метки товаров
|
// @Description Получить все метки товаров
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {array} LabelsList
|
// @Success 200 {array} LabelsList
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
// @Failure 500 {object} responses.ErrorResponse500
|
||||||
|
|
@ -506,7 +492,6 @@ func (co *controller) getLabels(c *gin.Context) {
|
||||||
// @Description Изменить метку
|
// @Description Изменить метку
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @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
|
||||||
|
|
@ -583,7 +568,6 @@ func (co *controller) deleteLabel(c *gin.Context) {
|
||||||
// @Description Прикрепить метку к товару
|
// @Description Прикрепить метку к товару
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
|
||||||
// @Param payload body LabelLink true "payload"
|
// @Param payload body LabelLink true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -618,7 +602,6 @@ func (co *controller) attachLabel(c *gin.Context) {
|
||||||
// @Description Удалить привязку метки к товару
|
// @Description Удалить привязку метки к товару
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Accept json
|
|
||||||
// @Param payload body LabelLink true "payload"
|
// @Param payload body LabelLink true "payload"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -653,7 +636,6 @@ func (co *controller) detachLabel(c *gin.Context) {
|
||||||
// @Description Получить метки товара по его uuid
|
// @Description Получить метки товара по его uuid
|
||||||
// @Tags Merch labels
|
// @Tags Merch labels
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Produce json
|
|
||||||
// @Param uuid path string true "label uuid"
|
// @Param uuid path string true "label uuid"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
// @Failure 400 {object} responses.ErrorResponse400
|
||||||
|
|
@ -684,109 +666,3 @@ func (co *controller) getMerchLabels(c *gin.Context) {
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, response)
|
c.JSON(http.StatusOK, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Получить нулевые цены
|
|
||||||
// @Description Получить нулевые цены
|
|
||||||
// @Tags Merch zero prices
|
|
||||||
// @Security BearerAuth
|
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {array} ZeroPrice
|
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
|
||||||
// @Router /merch/zeroprices [get]
|
|
||||||
func (co *controller) getZeroPrices(c *gin.Context) {
|
|
||||||
const logMsg = "Merch | Get zero prices"
|
|
||||||
|
|
||||||
userUuid, err := co.utils.GetUserUuidFromContext(c)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
response, err := co.service.getZeroPrices(userUuid)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
c.JSON(http.StatusOK, response)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Summary Пометить нулевые цены как удаленные
|
|
||||||
// @Description Пометить нулевые цены как удаленные
|
|
||||||
// @Tags Merch zero prices
|
|
||||||
// @Security BearerAuth
|
|
||||||
// @Accept json
|
|
||||||
// @Param payload body DeleteZeroPrices true "payload"
|
|
||||||
// @Success 200
|
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
|
||||||
// @Router /merch/zeroprices [delete]
|
|
||||||
func (co *controller) deleteZeroPrices(c *gin.Context) {
|
|
||||||
const logMsg = "Merch | Delete zero prices"
|
|
||||||
|
|
||||||
userUuid, err := co.utils.GetUserUuidFromContext(c)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var payload []DeleteZeroPrices
|
|
||||||
if err = c.ShouldBindJSON(&payload); err != nil {
|
|
||||||
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = co.service.deleteZeroPrices(userUuid, payload); err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.Status(http.StatusOK)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Summary Пометить нулевые цены как удаленные за указанный период
|
|
||||||
// @Description Пометить нулевые цены как удаленные за указанный период
|
|
||||||
// @Tags Merch zero prices
|
|
||||||
// @Security BearerAuth
|
|
||||||
// @Param start query string true "start"
|
|
||||||
// @Param end query string true "end"
|
|
||||||
// @Success 200
|
|
||||||
// @Failure 400 {object} responses.ErrorResponse400
|
|
||||||
// @Failure 500 {object} responses.ErrorResponse500
|
|
||||||
// @Router /merch/zeroprices/period [delete]
|
|
||||||
func (co *controller) deleteZeroPricesPeriod(c *gin.Context) {
|
|
||||||
const logMsg = "Merch | Delete zero prices period"
|
|
||||||
|
|
||||||
userUuid, err := co.utils.GetUserUuidFromContext(c)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
start, err := co.utils.ParseTime(c.Query("start"))
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
end, err := co.utils.ParseTime(c.Query("end"))
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(http.StatusBadRequest, responses.ErrorResponse400{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = co.service.deleteZeroPricesPeriod(userUuid, start, end); err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, responses.ErrorResponse500{Error: err.Error()})
|
|
||||||
log.WithError(err).Error(logMsg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.Status(http.StatusOK)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,30 @@
|
||||||
package merch
|
package merch
|
||||||
|
|
||||||
import (
|
|
||||||
"merch-parser-api/internal/api/merch/origins"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type merchBundle struct {
|
type merchBundle struct {
|
||||||
Merch *Merch
|
Merch *Merch
|
||||||
Surugaya *origins.OriginSurugaya
|
Surugaya *Surugaya
|
||||||
Mandarake *origins.OriginMandarake
|
Mandarake *Mandarake
|
||||||
Amiami *origins.OriginAmiami
|
|
||||||
}
|
}
|
||||||
type MerchDTO struct {
|
type MerchDTO struct {
|
||||||
MerchUuid string `json:"merch_uuid"`
|
MerchUuid string `json:"merch_uuid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
OriginSurugaya SurugayaDTO `json:"origin_surugaya"`
|
OriginSurugaya SurugayaDTO `json:"origin_surugaya"`
|
||||||
OriginMandarake MandarakeDTO `json:"origin_mandarake"`
|
OriginMandarake MandarakeDTO `json:"origin_mandarake"`
|
||||||
OriginAmiami AmiamiDTO `json:"origin_amiami"`
|
|
||||||
Labels []string `json:"labels,omitempty" gorm:"-"`
|
Labels []string `json:"labels,omitempty" gorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OriginDTO struct {
|
|
||||||
Link string `json:"link"`
|
|
||||||
Name origins.Origin `json:"name,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SurugayaDTO struct {
|
type SurugayaDTO struct {
|
||||||
OriginDTO
|
Link string `json:"link"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MandarakeDTO struct {
|
type MandarakeDTO struct {
|
||||||
OriginDTO
|
Link string `json:"link"`
|
||||||
}
|
|
||||||
|
|
||||||
type AmiamiDTO struct {
|
|
||||||
OriginDTO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SingleMerchResponse struct {
|
type SingleMerchResponse struct {
|
||||||
MerchUuid string `json:"merch_uuid"`
|
MerchUuid string `json:"merch_uuid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Origins []OriginDTO `json:"origins"`
|
Origins []any `json:"origins"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListResponse struct {
|
type ListResponse struct {
|
||||||
|
|
@ -55,7 +39,7 @@ type PriceEntry struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type OriginWithPrices struct {
|
type OriginWithPrices struct {
|
||||||
Origin origins.Origin `json:"origin"`
|
Origin Origin `json:"origin"`
|
||||||
Prices []PriceEntry
|
Prices []PriceEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,16 +78,3 @@ type LabelLink struct {
|
||||||
MerchUuid string `json:"merch_uuid"`
|
MerchUuid string `json:"merch_uuid"`
|
||||||
LabelUuid string `json:"label_uuid"`
|
LabelUuid string `json:"label_uuid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ZeroPrice struct {
|
|
||||||
Id int `json:"id"`
|
|
||||||
CreatedAt time.Time `json:"created_at"`
|
|
||||||
MerchUuid string `json:"merch_uuid"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Origin origins.Origin `json:"origin"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DeleteZeroPrices struct {
|
|
||||||
Id uint `json:"id"`
|
|
||||||
MerchUuid string `json:"merch_uuid"`
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package merch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"merch-parser-api/internal/api/merch/origins"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -20,14 +19,36 @@ func (Merch) TableName() string {
|
||||||
return "merch"
|
return "merch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Surugaya struct {
|
||||||
|
Id uint `gorm:"primary_key" json:"-"`
|
||||||
|
DeletedAt sql.NullTime `json:"-"`
|
||||||
|
MerchUuid string `json:"-"`
|
||||||
|
Link string `json:"link"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Surugaya) TableName() string {
|
||||||
|
return "origin_surugaya"
|
||||||
|
}
|
||||||
|
|
||||||
|
type Mandarake struct {
|
||||||
|
Id uint `gorm:"primary_key" json:"-"`
|
||||||
|
DeletedAt sql.NullTime `json:"-"`
|
||||||
|
MerchUuid string `json:"-"`
|
||||||
|
Link string `json:"link"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Mandarake) TableName() string {
|
||||||
|
return "origin_mandarake"
|
||||||
|
}
|
||||||
|
|
||||||
type Price struct {
|
type Price struct {
|
||||||
Id uint `json:"id" gorm:"primary_key"`
|
Id uint `json:"id" gorm:"primary_key"`
|
||||||
CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
|
CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
|
||||||
UpdatedAt sql.NullTime `json:"updated_at,omitempty" gorm:"column:updated_at"`
|
UpdatedAt sql.NullTime `json:"updated_at" gorm:"column:updated_at"`
|
||||||
DeletedAt sql.NullTime `json:"deleted_at,omitempty" gorm:"column:deleted_at"`
|
DeletedAt sql.NullTime `json:"deleted_at" gorm:"column:deleted_at"`
|
||||||
MerchUuid string `json:"merch_uuid" gorm:"column:merch_uuid"`
|
MerchUuid string `json:"merch_uuid" gorm:"column:merch_uuid"`
|
||||||
Price int `json:"price" gorm:"column:price"`
|
Price int `json:"price" gorm:"column:price"`
|
||||||
Origin origins.Origin `json:"origin" gorm:"column:origin;type:integer"`
|
Origin Origin `json:"origin" gorm:"column:origin;type:integer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Label struct {
|
type Label struct {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package origins
|
package merch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
|
|
@ -9,15 +9,13 @@ import (
|
||||||
type Origin int
|
type Origin int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Surugaya = (iota + 1) * 1000
|
surugaya = (iota + 1) * 1000
|
||||||
Mandarake
|
mandarake
|
||||||
Amiami
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Origins = [...]string{
|
var Origins = [...]string{
|
||||||
"surugaya",
|
"surugaya",
|
||||||
"mandarake",
|
"mandarake",
|
||||||
"amiami",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o Origin) String() string {
|
func (o Origin) String() string {
|
||||||
|
|
@ -32,7 +30,7 @@ func (o Origin) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(o.String())
|
return json.Marshal(o.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseOrigin(s string) (Origin, bool) {
|
func parseOrigin(s string) (Origin, bool) {
|
||||||
for i, name := range Origins {
|
for i, name := range Origins {
|
||||||
if name == strings.ToLower(s) {
|
if name == strings.ToLower(s) {
|
||||||
return Origin((i + 1) * 1000), true
|
return Origin((i + 1) * 1000), true
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
package origins
|
|
||||||
|
|
||||||
import "database/sql"
|
|
||||||
|
|
||||||
func AllOriginModels() []interface{} {
|
|
||||||
return []interface{}{
|
|
||||||
&OriginSurugaya{},
|
|
||||||
&OriginMandarake{},
|
|
||||||
&OriginAmiami{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSurugaya(merchUuid, link string) *OriginSurugaya {
|
|
||||||
return &OriginSurugaya{
|
|
||||||
BaseOrigin{
|
|
||||||
DeletedAt: sql.NullTime{},
|
|
||||||
MerchUuid: merchUuid,
|
|
||||||
Link: link,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMandarake(merchUuid, link string) *OriginMandarake {
|
|
||||||
return &OriginMandarake{
|
|
||||||
BaseOrigin{
|
|
||||||
DeletedAt: sql.NullTime{},
|
|
||||||
MerchUuid: merchUuid,
|
|
||||||
Link: link,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewAmiami(merchUuid, link string) *OriginAmiami {
|
|
||||||
return &OriginAmiami{
|
|
||||||
BaseOrigin{
|
|
||||||
DeletedAt: sql.NullTime{},
|
|
||||||
MerchUuid: merchUuid,
|
|
||||||
Link: link,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type OriginFactory func(merchUuid, link string) interface{}
|
|
||||||
|
|
||||||
var OriginFactories = map[string]OriginFactory{
|
|
||||||
"surugaya": func(merchUuid, link string) interface{} {
|
|
||||||
return &OriginSurugaya{BaseOrigin: BaseOrigin{MerchUuid: merchUuid, Link: link}}
|
|
||||||
},
|
|
||||||
"mandarake": func(merchUuid, link string) interface{} {
|
|
||||||
return &OriginMandarake{BaseOrigin: BaseOrigin{MerchUuid: merchUuid, Link: link}}
|
|
||||||
},
|
|
||||||
"amiami": func(merchUuid, link string) interface{} {
|
|
||||||
return &OriginAmiami{BaseOrigin: BaseOrigin{MerchUuid: merchUuid, Link: link}}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package origins
|
|
||||||
|
|
||||||
import "database/sql"
|
|
||||||
|
|
||||||
type BaseOrigin struct {
|
|
||||||
Id uint `gorm:"primary_key" json:"-"`
|
|
||||||
DeletedAt sql.NullTime `json:"-"`
|
|
||||||
MerchUuid string `json:"-"`
|
|
||||||
Link string `json:"link"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OriginSurugaya struct {
|
|
||||||
BaseOrigin
|
|
||||||
}
|
|
||||||
|
|
||||||
func (OriginSurugaya) TableName() string {
|
|
||||||
return "origin_surugaya"
|
|
||||||
}
|
|
||||||
|
|
||||||
type OriginMandarake struct {
|
|
||||||
BaseOrigin
|
|
||||||
}
|
|
||||||
|
|
||||||
func (OriginMandarake) TableName() string {
|
|
||||||
return "origin_mandarake"
|
|
||||||
}
|
|
||||||
|
|
||||||
type OriginAmiami struct {
|
|
||||||
BaseOrigin
|
|
||||||
}
|
|
||||||
|
|
||||||
func (OriginAmiami) TableName() string {
|
|
||||||
return "origin_amiami"
|
|
||||||
}
|
|
||||||
|
|
@ -4,14 +4,13 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"merch-parser-api/internal/api/merch/origins"
|
|
||||||
"merch-parser-api/internal/shared"
|
"merch-parser-api/internal/shared"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Link struct {
|
type Link struct {
|
||||||
Surugaya []origins.OriginSurugaya
|
Surugaya []Surugaya
|
||||||
Mandarake []origins.OriginMandarake
|
Mandarake []Mandarake
|
||||||
}
|
}
|
||||||
|
|
||||||
type TaskProvider struct {
|
type TaskProvider struct {
|
||||||
|
|
@ -85,7 +84,7 @@ func (p *TaskProvider) InsertPrices(prices []shared.TaskResult) error {
|
||||||
|
|
||||||
var insertPrices []Price
|
var insertPrices []Price
|
||||||
for _, item := range prices {
|
for _, item := range prices {
|
||||||
origin, ok := origins.ParseOrigin(item.Origin)
|
origin, ok := parseOrigin(item.Origin)
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -108,13 +107,13 @@ func (p *TaskProvider) InsertPrices(prices []shared.TaskResult) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *TaskRepo) getLinks() (*Link, error) {
|
func (r *TaskRepo) getLinks() (*Link, error) {
|
||||||
var surugayaList []origins.OriginSurugaya
|
var surugayaList []Surugaya
|
||||||
if err := r.db.Model(&origins.OriginSurugaya{}).Where("deleted_at IS NULL").Find(&surugayaList).Error; err != nil {
|
if err := r.db.Model(&Surugaya{}).Where("deleted_at IS NULL").Find(&surugayaList).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var mandarakeList []origins.OriginMandarake
|
var mandarakeList []Mandarake
|
||||||
if err := r.db.Model(&origins.OriginMandarake{}).Where("deleted_at IS NULL").Find(&mandarakeList).Error; err != nil {
|
if err := r.db.Model(&Mandarake{}).Where("deleted_at IS NULL").Find(&mandarakeList).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@ package merch
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"merch-parser-api/internal/api/merch/origins"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -24,7 +22,6 @@ type repository interface {
|
||||||
addMerch(bundle merchBundle) error
|
addMerch(bundle merchBundle) error
|
||||||
|
|
||||||
merchRecordExists(userUuid, merchUuid string) (bool, error)
|
merchRecordExists(userUuid, merchUuid string) (bool, error)
|
||||||
userOwnsMerchUuids(userUuid string, merchUuids []string) ([]Merch, error)
|
|
||||||
getSingleMerch(userUuid, merchUuid string) (merchBundle, error)
|
getSingleMerch(userUuid, merchUuid string) (merchBundle, error)
|
||||||
getAllMerch(userUuid string) ([]ListResponse, error)
|
getAllMerch(userUuid string) ([]ListResponse, error)
|
||||||
|
|
||||||
|
|
@ -41,10 +38,6 @@ type repository interface {
|
||||||
type prices interface {
|
type prices interface {
|
||||||
getPricesWithDays(userUuid string, period time.Time) ([]Price, error)
|
getPricesWithDays(userUuid string, period time.Time) ([]Price, error)
|
||||||
getDistinctPrices(userUuid, merchUuid string, period time.Time) (prices []Price, err error)
|
getDistinctPrices(userUuid, merchUuid string, period time.Time) (prices []Price, err error)
|
||||||
|
|
||||||
getZeroPrices(userUuid string) ([]ZeroPrice, error)
|
|
||||||
deleteZeroPrices(list []DeleteZeroPrices) error
|
|
||||||
deleteZeroPricesPeriod(userUuid string, start, end time.Time) error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type labels interface {
|
type labels interface {
|
||||||
|
|
@ -63,15 +56,11 @@ func (r *Repo) addMerch(bundle merchBundle) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.db.Model(&origins.OriginSurugaya{}).Create(bundle.Surugaya).Error; err != nil {
|
if err := r.db.Model(&Surugaya{}).Create(bundle.Surugaya).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.db.Model(&origins.OriginMandarake{}).Create(bundle.Mandarake).Error; err != nil {
|
if err := r.db.Model(&Mandarake{}).Create(bundle.Mandarake).Error; err != nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := r.db.Model(&origins.OriginAmiami{}).Create(bundle.Amiami).Error; err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,22 +81,6 @@ func (r *Repo) merchRecordExists(userUuid, merchUuid string) (bool, error) {
|
||||||
return exists, err
|
return exists, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Repo) userOwnsMerchUuids(userUuid string, merchUuids []string) ([]Merch, error) {
|
|
||||||
var ownsUuids []Merch
|
|
||||||
err := r.db.Model(&Merch{}).
|
|
||||||
Select("merch_uuid").
|
|
||||||
Where("user_uuid = ?", userUuid).
|
|
||||||
Where("merch_uuid IN (?)", merchUuids).
|
|
||||||
Where("deleted_at IS NULL").
|
|
||||||
Find(&ownsUuids).Error
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return ownsUuids, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Repo) getSingleMerch(userUuid, merchUuid string) (merchBundle, error) {
|
func (r *Repo) getSingleMerch(userUuid, merchUuid string) (merchBundle, error) {
|
||||||
var merch Merch
|
var merch Merch
|
||||||
if err := r.db.
|
if err := r.db.
|
||||||
|
|
@ -118,7 +91,7 @@ func (r *Repo) getSingleMerch(userUuid, merchUuid string) (merchBundle, error) {
|
||||||
return merchBundle{}, err
|
return merchBundle{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var surugaya origins.OriginSurugaya
|
var surugaya Surugaya
|
||||||
if err := r.db.
|
if err := r.db.
|
||||||
Where("merch_uuid = ?", merchUuid).
|
Where("merch_uuid = ?", merchUuid).
|
||||||
First(&surugaya).Error; err != nil {
|
First(&surugaya).Error; err != nil {
|
||||||
|
|
@ -127,7 +100,7 @@ func (r *Repo) getSingleMerch(userUuid, merchUuid string) (merchBundle, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mandarake origins.OriginMandarake
|
var mandarake Mandarake
|
||||||
if err := r.db.
|
if err := r.db.
|
||||||
Where("merch_uuid = ?", merchUuid).
|
Where("merch_uuid = ?", merchUuid).
|
||||||
First(&mandarake).Error; err != nil {
|
First(&mandarake).Error; err != nil {
|
||||||
|
|
@ -136,20 +109,10 @@ func (r *Repo) getSingleMerch(userUuid, merchUuid string) (merchBundle, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var amiami origins.OriginAmiami
|
|
||||||
if err := r.db.
|
|
||||||
Where("merch_uuid = ?", merchUuid).
|
|
||||||
First(&amiami).Error; err != nil {
|
|
||||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
|
||||||
return merchBundle{}, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return merchBundle{
|
return merchBundle{
|
||||||
Merch: &merch,
|
Merch: &merch,
|
||||||
Surugaya: &surugaya,
|
Surugaya: &surugaya,
|
||||||
Mandarake: &mandarake,
|
Mandarake: &mandarake,
|
||||||
Amiami: &amiami,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,13 +143,22 @@ func (r *Repo) updateMerch(payload UpdateMerchDTO, userUuid string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if factory, ok := origins.OriginFactories[payload.Origin]; ok {
|
switch payload.Origin {
|
||||||
model := factory(payload.MerchUuid, payload.Link)
|
case "surugaya":
|
||||||
if err := r.upsertOrigin(model); err != nil {
|
if err := r.upsertOrigin(&Surugaya{
|
||||||
|
MerchUuid: payload.MerchUuid,
|
||||||
|
Link: payload.Link,
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
case "mandarake":
|
||||||
|
if err := r.upsertOrigin(&Mandarake{
|
||||||
|
MerchUuid: payload.MerchUuid,
|
||||||
|
Link: payload.Link,
|
||||||
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else if payload.Origin != "" {
|
|
||||||
return fmt.Errorf("unsupported origin: %s", payload.Origin)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -203,15 +175,18 @@ func (r *Repo) deleteMerch(userUuid, merchUuid string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ors := origins.AllOriginModels()
|
if err := r.db.
|
||||||
|
Model(&Surugaya{}).
|
||||||
|
Where("merch_uuid = ?", merchUuid).
|
||||||
|
Update("deleted_at", now).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, origin := range ors {
|
if err := r.db.
|
||||||
if err := r.db.
|
Model(&Mandarake{}).
|
||||||
Model(origin).
|
Where("merch_uuid = ?", merchUuid).
|
||||||
Where("merch_uuid = ?", merchUuid).
|
Update("deleted_at", now).Error; err != nil {
|
||||||
Update("deleted_at", now).Error; err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -336,59 +311,3 @@ func (r *Repo) getAttachedLabelsByUuid(userUuid, merchUuid string) ([]CardLabel,
|
||||||
|
|
||||||
return labelsList, nil
|
return labelsList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Repo) getZeroPrices(userUuid string) ([]ZeroPrice, error) {
|
|
||||||
var priceList []ZeroPrice
|
|
||||||
if err := r.db.Raw(`
|
|
||||||
WITH price_with_neighbors AS (
|
|
||||||
SELECT
|
|
||||||
p.id, p.created_at, p.merch_uuid, p.price, p.origins, m.name,
|
|
||||||
LAG(price) OVER (PARTITION BY p.merch_uuid, p.origins ORDER BY p.created_at, p.id) AS prev_price,
|
|
||||||
LEAD(price) OVER (PARTITION BY p.merch_uuid, p.origins ORDER BY p.created_at, p.id) AS next_price
|
|
||||||
FROM prices AS p
|
|
||||||
JOIN merch as m ON m.merch_uuid = p.merch_uuid
|
|
||||||
WHERE p.deleted_at IS NULL
|
|
||||||
AND m.deleted_at IS NULL
|
|
||||||
AND m.user_uuid = ?)
|
|
||||||
|
|
||||||
SELECT
|
|
||||||
id, created_at, merch_uuid, origins, name
|
|
||||||
FROM price_with_neighbors
|
|
||||||
WHERE
|
|
||||||
price = 0
|
|
||||||
AND prev_price IS NOT NULL
|
|
||||||
AND prev_price > 0
|
|
||||||
AND next_price IS NOT NULL
|
|
||||||
AND next_price > 0;
|
|
||||||
`, userUuid).Scan(&priceList).Error; err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return priceList, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Repo) deleteZeroPrices(list []DeleteZeroPrices) error {
|
|
||||||
for _, item := range list {
|
|
||||||
if err := r.db.Model(&Price{}).
|
|
||||||
Where("id = ? AND merch_uuid = ?", item.Id, item.MerchUuid).
|
|
||||||
Update("deleted_at", time.Now().UTC()).Error; err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Repo) deleteZeroPricesPeriod(userUuid string, start, end time.Time) error {
|
|
||||||
if err := r.db.Exec(`
|
|
||||||
UPDATE prices
|
|
||||||
SET deleted_at = ?
|
|
||||||
FROM merch
|
|
||||||
WHERE prices.merch_uuid = merch.merch_uuid
|
|
||||||
AND merch.user_uuid = ?
|
|
||||||
AND prices.price = 0
|
|
||||||
AND prices.deleted_at IS NULL
|
|
||||||
AND prices.created_at BETWEEN ? AND ?;
|
|
||||||
`, time.Now().UTC(), userUuid, start, end).Error; err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
||||||
"image"
|
"image"
|
||||||
"image/jpeg"
|
"image/jpeg"
|
||||||
"io"
|
"io"
|
||||||
"merch-parser-api/internal/api/merch/origins"
|
|
||||||
"merch-parser-api/internal/interfaces"
|
"merch-parser-api/internal/interfaces"
|
||||||
is "merch-parser-api/proto/imageStorage"
|
is "merch-parser-api/proto/imageStorage"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
|
@ -59,7 +58,7 @@ func (s *service) addMerch(payload MerchDTO, userUuid string) error {
|
||||||
merchUuid := uuid.NewString()
|
merchUuid := uuid.NewString()
|
||||||
|
|
||||||
bundle := merchBundle{
|
bundle := merchBundle{
|
||||||
Merch: &Merch{
|
&Merch{
|
||||||
CreatedAt: time.Time{},
|
CreatedAt: time.Time{},
|
||||||
UpdatedAt: sql.NullTime{Valid: false},
|
UpdatedAt: sql.NullTime{Valid: false},
|
||||||
DeletedAt: sql.NullTime{Valid: false},
|
DeletedAt: sql.NullTime{Valid: false},
|
||||||
|
|
@ -68,40 +67,36 @@ func (s *service) addMerch(payload MerchDTO, userUuid string) error {
|
||||||
Name: payload.Name,
|
Name: payload.Name,
|
||||||
},
|
},
|
||||||
|
|
||||||
Surugaya: origins.NewSurugaya(merchUuid, payload.OriginSurugaya.Link),
|
&Surugaya{
|
||||||
Mandarake: origins.NewMandarake(merchUuid, payload.OriginMandarake.Link),
|
DeletedAt: sql.NullTime{},
|
||||||
Amiami: origins.NewAmiami(merchUuid, payload.OriginAmiami.Link),
|
MerchUuid: merchUuid,
|
||||||
|
Link: payload.OriginSurugaya.Link,
|
||||||
|
},
|
||||||
|
|
||||||
|
&Mandarake{
|
||||||
|
DeletedAt: sql.NullTime{},
|
||||||
|
MerchUuid: merchUuid,
|
||||||
|
Link: payload.OriginMandarake.Link,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return s.repo.addMerch(bundle)
|
return s.repo.addMerch(bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) getSingleMerch(userUuid, merchUuid string) (SingleMerchResponse, error) {
|
func (s *service) getSingleMerch(userUuid, merchUuid string) (MerchDTO, error) {
|
||||||
bundle, err := s.repo.getSingleMerch(userUuid, merchUuid)
|
bundle, err := s.repo.getSingleMerch(userUuid, merchUuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SingleMerchResponse{}, err
|
return MerchDTO{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var originsSlice []OriginDTO
|
return MerchDTO{
|
||||||
|
|
||||||
originsSlice = append(originsSlice, OriginDTO{
|
|
||||||
Link: bundle.Surugaya.Link,
|
|
||||||
Name: origins.Surugaya,
|
|
||||||
})
|
|
||||||
|
|
||||||
originsSlice = append(originsSlice, OriginDTO{
|
|
||||||
Link: bundle.Mandarake.Link,
|
|
||||||
Name: origins.Mandarake,
|
|
||||||
})
|
|
||||||
|
|
||||||
originsSlice = append(originsSlice, OriginDTO{
|
|
||||||
Link: bundle.Amiami.Link,
|
|
||||||
Name: origins.Amiami,
|
|
||||||
})
|
|
||||||
|
|
||||||
return SingleMerchResponse{
|
|
||||||
MerchUuid: bundle.Merch.MerchUuid,
|
MerchUuid: bundle.Merch.MerchUuid,
|
||||||
Name: bundle.Merch.Name,
|
Name: bundle.Merch.Name,
|
||||||
Origins: originsSlice,
|
OriginSurugaya: SurugayaDTO{
|
||||||
|
Link: bundle.Surugaya.Link,
|
||||||
|
},
|
||||||
|
OriginMandarake: MandarakeDTO{
|
||||||
|
Link: bundle.Mandarake.Link,
|
||||||
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +137,7 @@ func (s *service) updateMerch(payload UpdateMerchDTO, userUuid string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload.Origin == "" {
|
if payload.Origin == "" {
|
||||||
return errors.New("no origins provided")
|
return errors.New("no origin provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.repo.updateMerch(payload, userUuid)
|
return s.repo.updateMerch(payload, userUuid)
|
||||||
|
|
@ -183,10 +178,10 @@ func (s *service) getPrices(userUuid string, days string) ([]PricesResponse, err
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pricesMap := make(map[string]map[origins.Origin][]PriceEntry)
|
pricesMap := make(map[string]map[Origin][]PriceEntry)
|
||||||
for _, item := range pricesList {
|
for _, item := range pricesList {
|
||||||
if _, ok := pricesMap[item.MerchUuid]; !ok {
|
if _, ok := pricesMap[item.MerchUuid]; !ok {
|
||||||
pricesMap[item.MerchUuid] = make(map[origins.Origin][]PriceEntry)
|
pricesMap[item.MerchUuid] = make(map[Origin][]PriceEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
pricesMap[item.MerchUuid][item.Origin] = append(pricesMap[item.MerchUuid][item.Origin], PriceEntry{
|
pricesMap[item.MerchUuid][item.Origin] = append(pricesMap[item.MerchUuid][item.Origin], PriceEntry{
|
||||||
|
|
@ -197,22 +192,16 @@ func (s *service) getPrices(userUuid string, days string) ([]PricesResponse, err
|
||||||
|
|
||||||
for i := range response {
|
for i := range response {
|
||||||
originSurugaya := OriginWithPrices{
|
originSurugaya := OriginWithPrices{
|
||||||
Origin: origins.Surugaya,
|
Origin: surugaya,
|
||||||
Prices: pricesMap[response[i].MerchUuid][origins.Surugaya],
|
Prices: pricesMap[response[i].MerchUuid][surugaya],
|
||||||
}
|
}
|
||||||
response[i].Origins = append(response[i].Origins, originSurugaya)
|
response[i].Origins = append(response[i].Origins, originSurugaya)
|
||||||
|
|
||||||
originMandarake := OriginWithPrices{
|
originMandarake := OriginWithPrices{
|
||||||
Origin: origins.Mandarake,
|
Origin: mandarake,
|
||||||
Prices: pricesMap[response[i].MerchUuid][origins.Mandarake],
|
Prices: pricesMap[response[i].MerchUuid][mandarake],
|
||||||
}
|
}
|
||||||
response[i].Origins = append(response[i].Origins, originMandarake)
|
response[i].Origins = append(response[i].Origins, originMandarake)
|
||||||
|
|
||||||
originAmiami := OriginWithPrices{
|
|
||||||
Origin: origins.Amiami,
|
|
||||||
Prices: pricesMap[response[i].MerchUuid][origins.Amiami],
|
|
||||||
}
|
|
||||||
response[i].Origins = append(response[i].Origins, originAmiami)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response, nil
|
return response, nil
|
||||||
|
|
@ -229,37 +218,27 @@ func (s *service) getDistinctPrices(userUuid, merchUuid, days string) (PricesRes
|
||||||
}
|
}
|
||||||
|
|
||||||
originSurugaya := OriginWithPrices{
|
originSurugaya := OriginWithPrices{
|
||||||
Origin: origins.Surugaya,
|
Origin: surugaya,
|
||||||
Prices: []PriceEntry{},
|
Prices: []PriceEntry{},
|
||||||
}
|
}
|
||||||
|
|
||||||
originMandarake := OriginWithPrices{
|
originMandarake := OriginWithPrices{
|
||||||
Origin: origins.Mandarake,
|
Origin: mandarake,
|
||||||
Prices: []PriceEntry{},
|
|
||||||
}
|
|
||||||
|
|
||||||
originAmiami := OriginWithPrices{
|
|
||||||
Origin: origins.Amiami,
|
|
||||||
Prices: []PriceEntry{},
|
Prices: []PriceEntry{},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, item := range result {
|
for _, item := range result {
|
||||||
switch item.Origin {
|
switch item.Origin {
|
||||||
case origins.Surugaya:
|
case surugaya:
|
||||||
originSurugaya.Prices = append(originSurugaya.Prices, PriceEntry{
|
originSurugaya.Prices = append(originSurugaya.Prices, PriceEntry{
|
||||||
CreatedAt: item.CreatedAt.Unix(),
|
CreatedAt: item.CreatedAt.Unix(),
|
||||||
Value: item.Price,
|
Value: item.Price,
|
||||||
})
|
})
|
||||||
case origins.Mandarake:
|
case mandarake:
|
||||||
originMandarake.Prices = append(originMandarake.Prices, PriceEntry{
|
originMandarake.Prices = append(originMandarake.Prices, PriceEntry{
|
||||||
CreatedAt: item.CreatedAt.Unix(),
|
CreatedAt: item.CreatedAt.Unix(),
|
||||||
Value: item.Price,
|
Value: item.Price,
|
||||||
})
|
})
|
||||||
case origins.Amiami:
|
|
||||||
originAmiami.Prices = append(originAmiami.Prices, PriceEntry{
|
|
||||||
CreatedAt: item.CreatedAt.Unix(),
|
|
||||||
Value: item.Price,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -633,57 +612,3 @@ func (s *service) getMerchLabels(userUuid, merchUuid string) ([]string, error) {
|
||||||
|
|
||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) getZeroPrices(userUuid string) ([]ZeroPrice, error) {
|
|
||||||
return s.repo.getZeroPrices(userUuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) deleteZeroPrices(userUuid string, list []DeleteZeroPrices) error {
|
|
||||||
const delMsg = "Merch - service | Delete zero prices"
|
|
||||||
if len(list) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
ids := make([]string, 0, len(list))
|
|
||||||
for _, item := range list {
|
|
||||||
ids = append(ids, item.MerchUuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
uniqueMap := make(map[string]struct{}, len(list))
|
|
||||||
uniqueIds := make([]string, 0, len(list))
|
|
||||||
for _, id := range ids {
|
|
||||||
if _, ok := uniqueMap[id]; !ok {
|
|
||||||
uniqueMap[id] = struct{}{}
|
|
||||||
uniqueIds = append(uniqueIds, id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.WithField("uuid count", len(uniqueIds)).Debug(delMsg)
|
|
||||||
|
|
||||||
owns, err := s.repo.userOwnsMerchUuids(userUuid, uniqueIds)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(owns) < 1 {
|
|
||||||
return errors.New("wrong ids")
|
|
||||||
}
|
|
||||||
|
|
||||||
ownsMap := make(map[string]struct{}, len(owns))
|
|
||||||
for _, own := range owns {
|
|
||||||
ownsMap[own.MerchUuid] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
toDelete := make([]DeleteZeroPrices, 0, len(owns))
|
|
||||||
for _, item := range list {
|
|
||||||
if _, ok := ownsMap[item.MerchUuid]; ok {
|
|
||||||
toDelete = append(toDelete, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.repo.deleteZeroPrices(toDelete)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) deleteZeroPricesPeriod(userUuid string, start, end time.Time) error {
|
|
||||||
return s.repo.deleteZeroPricesPeriod(userUuid, start, end)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ func newController(service *service, utils interfaces.Utils) *controller {
|
||||||
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
|
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
|
||||||
userGroup := r.Group("/user")
|
userGroup := r.Group("/user")
|
||||||
|
|
||||||
userGroup.POST("", h.controller.register)
|
userGroup.POST("/", h.controller.register)
|
||||||
userGroup.GET("", authMW, h.controller.get)
|
userGroup.GET("/", authMW, h.controller.get)
|
||||||
userGroup.PUT("", authMW, h.controller.update)
|
userGroup.PUT("/", authMW, h.controller.update)
|
||||||
userGroup.DELETE("", authMW, h.controller.delete)
|
userGroup.DELETE("/", authMW, h.controller.delete)
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)
|
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func (r *repo) getByUuid(userUuid string) (user User, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) update(user map[string]any) error {
|
func (r *repo) update(user map[string]any) error {
|
||||||
return r.db.Model(&User{}).Where("uuid = ?", user["uuid"]).Updates(&user).Error
|
return r.db.Where("uuid = ?", user["uuid"]).Updates(&user).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) delete(userUuid string) error {
|
func (r *repo) delete(userUuid string) error {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package interfaces
|
package interfaces
|
||||||
|
|
||||||
import (
|
import "github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Utils interface {
|
type Utils interface {
|
||||||
IsEmail(email string) bool
|
IsEmail(email string) bool
|
||||||
|
|
@ -11,5 +8,4 @@ type Utils interface {
|
||||||
GetRefreshUuidFromContext(c *gin.Context) (string, error)
|
GetRefreshUuidFromContext(c *gin.Context) (string, error)
|
||||||
HashPassword(password string) (string, error)
|
HashPassword(password string) (string, error)
|
||||||
ComparePasswords(hashedPassword string, plainPassword string) error
|
ComparePasswords(hashedPassword string, plainPassword string) error
|
||||||
ParseTime(t string) (time.Time, error)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,6 @@ CREATE TABLE origin_mandarake(
|
||||||
link TEXT
|
link TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE origin_amiami(
|
|
||||||
id BIGSERIAL PRIMARY KEY,
|
|
||||||
deleted_at TIMESTAMP WITH TIME ZONE NULL,
|
|
||||||
merch_uuid VARCHAR(36) NOT NULL UNIQUE,
|
|
||||||
link TEXT
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE prices(
|
CREATE TABLE prices(
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
package utils
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
func (u *Utils) ParseTime(t string) (time.Time, error) {
|
|
||||||
timeStr, err := time.Parse(time.RFC3339, t)
|
|
||||||
if err != nil {
|
|
||||||
return time.Time{}, err
|
|
||||||
}
|
|
||||||
return timeStr, nil
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue