This commit is contained in:
parent
2728051fde
commit
7fa79d770a
4 changed files with 114 additions and 54 deletions
|
|
@ -95,7 +95,7 @@ func (co *controller) addMerch(c *gin.Context) {
|
|||
// @Description Получить всю информацию про мерч по его uuid
|
||||
// @Tags Merch
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Param uuid path string true "merch_uuid"
|
||||
// @Success 200 {object} MerchDTO
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
|
|
@ -129,7 +129,7 @@ func (co *controller) getSingleMerch(c *gin.Context) {
|
|||
// @Description Получить все записи мерча
|
||||
// @Tags Merch
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Success 200 {array} ListResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
|
|
@ -156,7 +156,7 @@ func (co *controller) getAllMerch(c *gin.Context) {
|
|||
// @Description Обновить информацию про мерч по его uuid в json-е
|
||||
// @Tags Merch
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Accept json
|
||||
// @Param body body UpdateMerchDTO true "merch_uuid"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
|
|
@ -182,6 +182,7 @@ func (co *controller) updateMerch(c *gin.Context) {
|
|||
log.WithError(err).Error("Merch | Failed to get single merch")
|
||||
return
|
||||
}
|
||||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
||||
// @Summary Пометить мерч как удаленный
|
||||
|
|
@ -192,7 +193,8 @@ func (co *controller) updateMerch(c *gin.Context) {
|
|||
// @Success 200 {object} MerchDTO
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /merch/{uuid} [delete]
|
||||
//
|
||||
// @Router /merch/{uuid} [delete]
|
||||
func (co *controller) deleteMerch(c *gin.Context) {
|
||||
merchUuid := c.Param("uuid")
|
||||
if merchUuid == "" {
|
||||
|
|
@ -220,12 +222,16 @@ func (co *controller) deleteMerch(c *gin.Context) {
|
|||
// @Description Получить цены мерча за период
|
||||
// @Tags Merch
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Param days query string false "period in days"
|
||||
// @Success 200 {array} PricesResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /prices [get]
|
||||
//
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /prices [get]
|
||||
func (co *controller) getChartsPrices(c *gin.Context) {
|
||||
daysQuery := strings.ToLower(c.DefaultQuery("days", ""))
|
||||
|
||||
|
|
@ -250,7 +256,7 @@ func (co *controller) getChartsPrices(c *gin.Context) {
|
|||
// @Description Получить перепады цен мерча за период по его merch_uuid
|
||||
// @Tags Merch
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Param uuid path string true "merch_uuid"
|
||||
// @Param days query string false "period in days"
|
||||
// @Success 200 {object} PricesResponse
|
||||
|
|
@ -338,7 +344,6 @@ func (co *controller) uploadMerchImage(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
//c.Status(http.StatusOK)
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
|
|
@ -346,7 +351,7 @@ func (co *controller) uploadMerchImage(c *gin.Context) {
|
|||
// @Description Получить картинки по merch_uuid и query параметрам
|
||||
// @Tags Merch images
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Param uuid path string true "merch_uuid"
|
||||
// @Param type query string true "image type"
|
||||
// @Success 200 {object} ImageLink
|
||||
|
|
@ -393,7 +398,6 @@ func (co *controller) getMerchImage(c *gin.Context) {
|
|||
//}
|
||||
//
|
||||
//c.JSON(http.StatusOK, link)
|
||||
c.JSON(http.StatusNotImplemented, gin.H{"msg": "Method deprecated. Request images from image storage."})
|
||||
}
|
||||
|
||||
// @Summary Удалить (безвозвратно) картинки по merch_uuid
|
||||
|
|
@ -438,7 +442,7 @@ func (co *controller) deleteMerchImage(c *gin.Context) {
|
|||
// @Description Создать новую метку для товара
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Accept json
|
||||
// @Param payload body LabelDTO true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
|
|
@ -474,7 +478,7 @@ func (co *controller) createLabel(c *gin.Context) {
|
|||
// @Description Получить все метки товаров
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Success 200 {array} LabelsList
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
|
|
@ -503,7 +507,7 @@ func (co *controller) getLabels(c *gin.Context) {
|
|||
// @Description Изменить метку
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Accept json
|
||||
// @Param uuid path string true "label uuid"
|
||||
// @Param payload body LabelDTO true "payload"
|
||||
// @Success 200
|
||||
|
|
@ -576,16 +580,16 @@ func (co *controller) deleteLabel(c *gin.Context) {
|
|||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
||||
// @Summary Прикрепить метку к товару
|
||||
// @Description Прикрепить метку к товару
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Param payload body LabelLink true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /merch/labels/attach [post]
|
||||
// @Summary Прикрепить метку к товару
|
||||
// @Description Прикрепить метку к товару
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// @Accept json
|
||||
// @Param payload body LabelLink true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /merch/labels/attach [post]
|
||||
func (co *controller) attachLabel(c *gin.Context) {
|
||||
const logMsg = "Merch | Attach label"
|
||||
|
||||
|
|
@ -611,16 +615,16 @@ func (co *controller) attachLabel(c *gin.Context) {
|
|||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
||||
// @Summary Удалить привязку метки к товару
|
||||
// @Description Удалить привязку метки к товару
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Param payload body LabelLink true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /merch/labels/detach [post]
|
||||
// @Summary Удалить привязку метки к товару
|
||||
// @Description Удалить привязку метки к товару
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// @Accept json
|
||||
// @Param payload body LabelLink true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @Router /merch/labels/detach [post]
|
||||
func (co *controller) detachLabel(c *gin.Context) {
|
||||
const logMsg = "Merch | Detach label"
|
||||
|
||||
|
|
@ -650,7 +654,7 @@ func (co *controller) detachLabel(c *gin.Context) {
|
|||
// @Description Получить метки товара по его uuid
|
||||
// @Tags Merch labels
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Produce json
|
||||
// @Param uuid path string true "label uuid"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
|
|
@ -686,10 +690,10 @@ func (co *controller) getMerchLabels(c *gin.Context) {
|
|||
// @Description Получить нулевые цены
|
||||
// @Tags Merch zero prices
|
||||
// @Security BearerAuth
|
||||
// @Produce json
|
||||
// @Success 200 {array} ZeroPrice
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @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"
|
||||
|
|
@ -715,11 +719,11 @@ func (co *controller) getZeroPrices(c *gin.Context) {
|
|||
// @Description Пометить нулевые цены как удаленные
|
||||
// @Tags Merch zero prices
|
||||
// @Security BearerAuth
|
||||
// Accept json
|
||||
// @Accept json
|
||||
// @Param payload body DeleteZeroPrices true "payload"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} responses.ErrorResponse400
|
||||
// @Failure 500 {object} responses.ErrorResponse500
|
||||
// @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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue