Compare commits

..

No commits in common. "a0e21db5a09e7e13d026611c1f068ca27fbe9ed1" and "8186d8a46cbfeddef48bb142fcccc6292a2bbc14" have entirely different histories.

10 changed files with 8 additions and 623 deletions

View file

@ -68,9 +68,6 @@ const docTemplate = `{
}
],
"description": "Получить все записи мерча",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -148,9 +145,6 @@ const docTemplate = `{
}
],
"description": "Получить картинки по merch_uuid и query параметрам",
"produces": [
"application/json"
],
"tags": [
"Merch images"
],
@ -293,9 +287,6 @@ const docTemplate = `{
}
],
"description": "Получить все метки товаров",
"produces": [
"application/json"
],
"tags": [
"Merch labels"
],
@ -450,47 +441,6 @@ const docTemplate = `{
}
},
"/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": {
"security": [
{
@ -577,86 +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": "Пометить нулевые цены как удаленные",
"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/{uuid}": {
"get": {
"security": [
@ -665,9 +535,6 @@ const docTemplate = `{
}
],
"description": "Получить всю информацию про мерч по его uuid",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -752,9 +619,6 @@ const docTemplate = `{
}
],
"description": "Получить цены мерча за период",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -800,9 +664,6 @@ const docTemplate = `{
}
],
"description": "Получить перепады цен мерча за период по его merch_uuid",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -1157,17 +1018,6 @@ const docTemplate = `{
}
}
},
"merch.DeleteZeroPrices": {
"type": "object",
"properties": {
"merch_uuids": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"merch.ImageLink": {
"type": "object",
"properties": {
@ -1224,12 +1074,6 @@ const docTemplate = `{
"merch.ListResponse": {
"type": "object",
"properties": {
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"merch_uuid": {
"type": "string"
},
@ -1249,12 +1093,6 @@ const docTemplate = `{
"merch.MerchDTO": {
"type": "object",
"properties": {
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"merch_uuid": {
"type": "string"
},
@ -1336,23 +1174,6 @@ const docTemplate = `{
}
}
},
"merch.ZeroPrice": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
},
"origin": {
"type": "string"
}
}
},
"responses.ErrorResponse400": {
"type": "object",
"properties": {

View file

@ -60,9 +60,6 @@
}
],
"description": "Получить все записи мерча",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -140,9 +137,6 @@
}
],
"description": "Получить картинки по merch_uuid и query параметрам",
"produces": [
"application/json"
],
"tags": [
"Merch images"
],
@ -285,9 +279,6 @@
}
],
"description": "Получить все метки товаров",
"produces": [
"application/json"
],
"tags": [
"Merch labels"
],
@ -442,47 +433,6 @@
}
},
"/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": {
"security": [
{
@ -569,86 +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": "Пометить нулевые цены как удаленные",
"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/{uuid}": {
"get": {
"security": [
@ -657,9 +527,6 @@
}
],
"description": "Получить всю информацию про мерч по его uuid",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -744,9 +611,6 @@
}
],
"description": "Получить цены мерча за период",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -792,9 +656,6 @@
}
],
"description": "Получить перепады цен мерча за период по его merch_uuid",
"produces": [
"application/json"
],
"tags": [
"Merch"
],
@ -1149,17 +1010,6 @@
}
}
},
"merch.DeleteZeroPrices": {
"type": "object",
"properties": {
"merch_uuids": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"merch.ImageLink": {
"type": "object",
"properties": {
@ -1216,12 +1066,6 @@
"merch.ListResponse": {
"type": "object",
"properties": {
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"merch_uuid": {
"type": "string"
},
@ -1241,12 +1085,6 @@
"merch.MerchDTO": {
"type": "object",
"properties": {
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"merch_uuid": {
"type": "string"
},
@ -1328,23 +1166,6 @@
}
}
},
"merch.ZeroPrice": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"merch_uuid": {
"type": "string"
},
"name": {
"type": "string"
},
"origin": {
"type": "string"
}
}
},
"responses.ErrorResponse400": {
"type": "object",
"properties": {

View file

@ -7,13 +7,6 @@ definitions:
thumbnail:
type: string
type: object
merch.DeleteZeroPrices:
properties:
merch_uuids:
items:
type: string
type: array
type: object
merch.ImageLink:
properties:
etag:
@ -50,10 +43,6 @@ definitions:
type: object
merch.ListResponse:
properties:
labels:
items:
type: string
type: array
merch_uuid:
type: string
name:
@ -66,10 +55,6 @@ definitions:
type: object
merch.MerchDTO:
properties:
labels:
items:
type: string
type: array
merch_uuid:
type: string
name:
@ -122,17 +107,6 @@ definitions:
origin:
type: string
type: object
merch.ZeroPrice:
properties:
created_at:
type: string
merch_uuid:
type: string
name:
type: string
origin:
type: string
type: object
responses.ErrorResponse400:
properties:
error:
@ -231,8 +205,6 @@ paths:
/merch/:
get:
description: Получить все записи мерча
produces:
- application/json
responses:
"200":
description: OK
@ -313,8 +285,6 @@ paths:
name: uuid
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
@ -371,8 +341,6 @@ paths:
name: type
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
@ -430,8 +398,6 @@ paths:
/merch/labels:
get:
description: Получить все метки товаров
produces:
- application/json
responses:
"200":
description: OK
@ -502,32 +468,6 @@ paths:
summary: Пометить метку как удаленную
tags:
- Merch labels
get:
description: Получить метки товара по его uuid
parameters:
- description: label uuid
in: path
name: uuid
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse400'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.ErrorResponse500'
security:
- BearerAuth: []
summary: Получить метки товара по его uuid
tags:
- Merch labels
put:
description: Изменить метку
parameters:
@ -610,56 +550,6 @@ paths:
summary: Удалить привязку метки к товару
tags:
- Merch labels
/merch/zeroprices:
delete:
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
/prices:
get:
description: Получить цены мерча за период
@ -668,8 +558,6 @@ paths:
in: query
name: days
type: string
produces:
- application/json
responses:
"200":
description: OK
@ -703,8 +591,6 @@ paths:
in: query
name: days
type: string
produces:
- application/json
responses:
"200":
description: OK

View file

@ -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) {
merchGroup := r.Group("/merch", authMW)
merchGroup.POST("/", h.controller.addMerch)
merchGroup.GET("/:uuid", h.controller.getSingleMerch)
merchGroup.GET("/", h.controller.getAllMerch)
@ -50,10 +51,6 @@ func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, ref
labelsGroup.POST("/attach", h.controller.attachLabel)
labelsGroup.POST("/detach", h.controller.detachLabel)
labelsGroup.GET("/:uuid", h.controller.getMerchLabels)
zeroPricesGroup := merchGroup.Group("/zeroprices", authMW)
zeroPricesGroup.GET("", h.controller.getZeroPrices)
zeroPricesGroup.DELETE("", h.controller.deleteZeroPrices)
}
// @Summary Добавить новый мерч
@ -95,7 +92,6 @@ func (co *controller) addMerch(c *gin.Context) {
// @Description Получить всю информацию про мерч по его uuid
// @Tags Merch
// @Security BearerAuth
// @Produce json
// @Param uuid path string true "merch_uuid"
// @Success 200 {object} MerchDTO
// @Failure 400 {object} responses.ErrorResponse400
@ -129,7 +125,6 @@ func (co *controller) getSingleMerch(c *gin.Context) {
// @Description Получить все записи мерча
// @Tags Merch
// @Security BearerAuth
// @Produce json
// @Success 200 {array} ListResponse
// @Failure 400 {object} responses.ErrorResponse400
// @Failure 500 {object} responses.ErrorResponse500
@ -156,7 +151,6 @@ func (co *controller) getAllMerch(c *gin.Context) {
// @Description Обновить информацию про мерч по его uuid в json-е
// @Tags Merch
// @Security BearerAuth
// Accept json
// @Param body body UpdateMerchDTO true "merch_uuid"
// @Success 200
// @Failure 400 {object} responses.ErrorResponse400
@ -220,7 +214,6 @@ func (co *controller) deleteMerch(c *gin.Context) {
// @Description Получить цены мерча за период
// @Tags Merch
// @Security BearerAuth
// @Produce json
// @Param days query string false "period in days"
// @Success 200 {array} PricesResponse
// @Failure 400 {object} responses.ErrorResponse400
@ -250,7 +243,6 @@ func (co *controller) getChartsPrices(c *gin.Context) {
// @Description Получить перепады цен мерча за период по его merch_uuid
// @Tags Merch
// @Security BearerAuth
// @Produce json
// @Param uuid path string true "merch_uuid"
// @Param days query string false "period in days"
// @Success 200 {object} PricesResponse
@ -346,7 +338,6 @@ func (co *controller) uploadMerchImage(c *gin.Context) {
// @Description Получить картинки по merch_uuid и query параметрам
// @Tags Merch images
// @Security BearerAuth
// @Produce json
// @Param uuid path string true "merch_uuid"
// @Param type query string true "image type"
// @Success 200 {object} ImageLink
@ -438,7 +429,6 @@ func (co *controller) deleteMerchImage(c *gin.Context) {
// @Description Создать новую метку для товара
// @Tags Merch labels
// @Security BearerAuth
// Accept json
// @Param payload body LabelDTO true "payload"
// @Success 200
// @Failure 400 {object} responses.ErrorResponse400
@ -474,7 +464,6 @@ func (co *controller) createLabel(c *gin.Context) {
// @Description Получить все метки товаров
// @Tags Merch labels
// @Security BearerAuth
// @Produce json
// @Success 200 {array} LabelsList
// @Failure 400 {object} responses.ErrorResponse400
// @Failure 500 {object} responses.ErrorResponse500
@ -503,7 +492,6 @@ func (co *controller) getLabels(c *gin.Context) {
// @Description Изменить метку
// @Tags Merch labels
// @Security BearerAuth
// Accept json
// @Param uuid path string true "label uuid"
// @Param payload body LabelDTO true "payload"
// @Success 200
@ -580,7 +568,6 @@ func (co *controller) deleteLabel(c *gin.Context) {
// @Description Прикрепить метку к товару
// @Tags Merch labels
// @Security BearerAuth
// Accept json
// @Param payload body LabelLink true "payload"
// @Success 200
// @Failure 400 {object} responses.ErrorResponse400
@ -615,7 +602,6 @@ func (co *controller) attachLabel(c *gin.Context) {
// @Description Удалить привязку метки к товару
// @Tags Merch labels
// @Security BearerAuth
// Accept json
// @Param payload body LabelLink true "payload"
// @Success 200
// @Failure 400 {object} responses.ErrorResponse400
@ -650,7 +636,6 @@ func (co *controller) detachLabel(c *gin.Context) {
// @Description Получить метки товара по его uuid
// @Tags Merch labels
// @Security BearerAuth
// @Produce json
// @Param uuid path string true "label uuid"
// @Success 200
// @Failure 400 {object} responses.ErrorResponse400
@ -681,67 +666,3 @@ func (co *controller) getMerchLabels(c *gin.Context) {
}
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)
}

View file

@ -1,7 +1,5 @@
package merch
import "time"
type merchBundle struct {
Merch *Merch
Surugaya *Surugaya
@ -80,14 +78,3 @@ type LabelLink struct {
MerchUuid string `json:"merch_uuid"`
LabelUuid string `json:"label_uuid"`
}
type ZeroPrice struct {
CreatedAt time.Time `json:"created_at"`
MerchUuid string `json:"merch_uuid"`
Name string `json:"name"`
Origin string `json:"origin"`
}
type DeleteZeroPrices struct {
MerchUuids []string `json:"merch_uuids"`
}

View file

@ -44,8 +44,8 @@ func (Mandarake) TableName() string {
type Price struct {
Id uint `json:"id" gorm:"primary_key"`
CreatedAt time.Time `json:"created_at" gorm:"column:created_at"`
UpdatedAt sql.NullTime `json:"updated_at,omitempty" gorm:"column:updated_at"`
DeletedAt sql.NullTime `json:"deleted_at,omitempty" gorm:"column:deleted_at"`
UpdatedAt sql.NullTime `json:"updated_at" gorm:"column:updated_at"`
DeletedAt sql.NullTime `json:"deleted_at" gorm:"column:deleted_at"`
MerchUuid string `json:"merch_uuid" gorm:"column:merch_uuid"`
Price int `json:"price" gorm:"column:price"`
Origin Origin `json:"origin" gorm:"column:origin;type:integer"`

View file

@ -38,9 +38,6 @@ type repository interface {
type prices interface {
getPricesWithDays(userUuid string, period time.Time) ([]Price, error)
getDistinctPrices(userUuid, merchUuid string, period time.Time) (prices []Price, err error)
getZeroPrices(userUuid string) ([]ZeroPrice, error)
deleteZeroPrices(userUuid string, list []string) error
}
type labels interface {
@ -314,43 +311,3 @@ func (r *Repo) getAttachedLabelsByUuid(userUuid, merchUuid string) ([]CardLabel,
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.created_at, p.merch_uuid, p.price, p.origin, m.name,
LAG(price) OVER (PARTITION BY p.merch_uuid ORDER BY p.created_at, p.id) AS prev_price,
LEAD(price) OVER (PARTITION BY p.merch_uuid 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.user_uuid = ?)
SELECT
created_at, merch_uuid, origin, 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(userUuid string, list []string) error {
subQuery := r.db.Table("merch").
Select("merch_uuid").
Where("user_uuid = ?", userUuid)
return r.db.Model(&Price{}).
Where("merch_uuid IN ?", list).
Where("merch_uuid IN (?)", subQuery).
Update("deleted_at", time.Now().UTC()).
Error
}

View file

@ -612,11 +612,3 @@ func (s *service) getMerchLabels(userUuid, merchUuid string) ([]string, error) {
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 {
return s.repo.deleteZeroPrices(userUuid, list.MerchUuids)
}

View file

@ -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) {
userGroup := r.Group("/user")
userGroup.POST("", h.controller.register)
userGroup.GET("", authMW, h.controller.get)
userGroup.PUT("", authMW, h.controller.update)
userGroup.DELETE("", authMW, h.controller.delete)
userGroup.POST("/", h.controller.register)
userGroup.GET("/", authMW, h.controller.get)
userGroup.PUT("/", authMW, h.controller.update)
userGroup.DELETE("/", authMW, h.controller.delete)
//auth
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)

View file

@ -40,7 +40,7 @@ func (r *repo) getByUuid(userUuid string) (user User, err 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 {