feat: mapstructure tags for wishlist service dtos
This commit is contained in:
@@ -52,6 +52,7 @@ require (
|
|||||||
github.com/minio/crc64nvme v1.0.2 // indirect
|
github.com/minio/crc64nvme v1.0.2 // indirect
|
||||||
github.com/minio/md5-simd v1.1.2 // indirect
|
github.com/minio/md5-simd v1.1.2 // indirect
|
||||||
github.com/minio/minio-go/v7 v7.0.95 // indirect
|
github.com/minio/minio-go/v7 v7.0.95 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
|||||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||||
github.com/minio/minio-go/v7 v7.0.95 h1:ywOUPg+PebTMTzn9VDsoFJy32ZuARN9zhB+K3IYEvYU=
|
github.com/minio/minio-go/v7 v7.0.95 h1:ywOUPg+PebTMTzn9VDsoFJy32ZuARN9zhB+K3IYEvYU=
|
||||||
github.com/minio/minio-go/v7 v7.0.95/go.mod h1:wOOX3uxS334vImCNRVyIDdXX9OsXDm89ToynKgqUKlo=
|
github.com/minio/minio-go/v7 v7.0.95/go.mod h1:wOOX3uxS334vImCNRVyIDdXX9OsXDm89ToynKgqUKlo=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
|||||||
@@ -18,38 +18,38 @@
|
|||||||
package dto
|
package dto
|
||||||
|
|
||||||
type WishListDto struct {
|
type WishListDto struct {
|
||||||
Guid string `json:"guid"`
|
Guid string `json:"guid" mapstructure:"guid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name" mapstructure:"name"`
|
||||||
Hidden bool `json:"hidden"`
|
Hidden bool `json:"hidden" mapstructure:"hidden"`
|
||||||
IconName string `json:"icon_name"`
|
IconName string `json:"icon_name" mapstructure:"icon_name"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color" mapstructure:"color"`
|
||||||
ColorGrad string `json:"color_grad"`
|
ColorGrad string `json:"color_grad" mapstructure:"color_grad"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewWishListDto struct {
|
type NewWishListDto struct {
|
||||||
Name string `json:"name" binding:"required" validate:"max=32"`
|
Name string `json:"name" mapstructure:"name" binding:"required" validate:"max=32"`
|
||||||
Hidden bool `json:"hidden"`
|
Hidden bool `json:"hidden" mapstructure:"hidden"`
|
||||||
IconName string `json:"icon_name" validate:"omitempty,max=64"`
|
IconName string `json:"icon_name" mapstructure:"icon_name" validate:"omitempty,max=64"`
|
||||||
Color string `json:"color" validate:"omitempty,color_hex"`
|
Color string `json:"color" mapstructure:"color" validate:"omitempty,color_hex"`
|
||||||
ColorGrad string `json:"color_grad" validate:"omitempty,color_hex"`
|
ColorGrad string `json:"color_grad" mapstructure:"color_grad" validate:"omitempty,color_hex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WishDto struct {
|
type WishDto struct {
|
||||||
Guid string `json:"guid"`
|
Guid string `json:"guid" mapstructure:"guid"`
|
||||||
WishListGuid string `json:"wish_list_guid"`
|
WishListGuid string `json:"wish_list_guid" mapstructure:"wish_list_guid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name" mapstructure:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" mapstructure:"description"`
|
||||||
PictureUrl string `json:"picture_url"`
|
PictureUrl string `json:"picture_url" mapstructure:"picture_url"`
|
||||||
Stars int `json:"stars"`
|
Stars int `json:"stars" mapstructure:"stars"`
|
||||||
CreationDate int64 `json:"creation_date"`
|
CreationDate int64 `json:"creation_date" mapstructure:"creation_date"`
|
||||||
Fulfilled bool `json:"fulfilled"`
|
Fulfilled bool `json:"fulfilled" mapstructure:"fulfilled"`
|
||||||
FulfilledDate int64 `json:"fulfilled_date"`
|
FulfilledDate int64 `json:"fulfilled_date" mapstructure:"fulfilled_date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewWishDto struct {
|
type NewWishDto struct {
|
||||||
WishListGuid string `json:"wish_list_guid" binding:"required" validate:"guid"`
|
WishListGuid string `json:"wish_list_guid" mapstructure:"wish_list_guid" binding:"required" validate:"guid"`
|
||||||
Name string `json:"name" binding:"required" validate:"max=64"`
|
Name string `json:"name" mapstructure:"name" binding:"required" validate:"max=64"`
|
||||||
Description string `json:"description" validate:"omitempty,max=1000"`
|
Description string `json:"description" mapstructure:"description" validate:"omitempty,max=1000"`
|
||||||
PictureUploadId string `json:"picture_upload_id" validate:"omitempty,upload_id=image"`
|
PictureUploadId string `json:"picture_upload_id" mapstructure:"picture_upload_id" validate:"omitempty,upload_id=image"`
|
||||||
Stars int `json:"stars" validate:"min=1,max=5"`
|
Stars int `json:"stars" mapstructure:"stars" validate:"min=1,max=5"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user