refactor: adjustments to variable namings
This commit is contained in:
@@ -402,7 +402,7 @@ VALUES (
|
||||
$3::text,
|
||||
$4::text,
|
||||
$5::text,
|
||||
$6::boolean
|
||||
$6::text
|
||||
)
|
||||
RETURNING id, guid, profile_id, hidden, name, icon_name, color, color_grad, deleted
|
||||
`
|
||||
@@ -413,7 +413,7 @@ type CreateWishListParams struct {
|
||||
Name string
|
||||
IconName string
|
||||
Color string
|
||||
ColorGrad bool
|
||||
ColorGrad string
|
||||
}
|
||||
|
||||
func (q *Queries) CreateWishList(ctx context.Context, arg CreateWishListParams) (WishList, error) {
|
||||
|
||||
@@ -50,6 +50,6 @@ type NewWishDto struct {
|
||||
WishListGuid string `json:"wish_list_guid" mapstructure:"wish_list_guid" binding:"required" validate:"guid"`
|
||||
Name string `json:"name" mapstructure:"name" binding:"required" validate:"max=64"`
|
||||
Description string `json:"description" mapstructure:"description" validate:"omitempty,max=1000"`
|
||||
PictureUploadId string `json:"picture_upload_id" mapstructure:"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" mapstructure:"stars" validate:"min=1,max=5"`
|
||||
}
|
||||
|
||||
@@ -110,15 +110,15 @@ func (w wishListServiceImpl) CreateWish(cinfo dto.ClientInfo, object dto.NewWish
|
||||
}
|
||||
|
||||
var avatarUrl *string
|
||||
if object.PictureUploadId != "" {
|
||||
key, err := w.s3.SaveUpload(object.PictureUploadId, "images"); if err != nil {
|
||||
if object.PictureUploadID != "" {
|
||||
key, err := w.s3.SaveUpload(object.PictureUploadID, "images"); if err != nil {
|
||||
if errors.Is(err, errs.ErrFileNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w.log.Error(
|
||||
"Failed to save image",
|
||||
zap.String("upload_id", object.PictureUploadId),
|
||||
zap.String("upload_id", object.PictureUploadID),
|
||||
zap.String("username", cinfo.Username),
|
||||
zap.Error(err))
|
||||
return nil, errs.ErrServerError
|
||||
@@ -158,7 +158,41 @@ func (w wishListServiceImpl) CreateWish(cinfo dto.ClientInfo, object dto.NewWish
|
||||
}
|
||||
|
||||
func (w wishListServiceImpl) CreateWishList(cinfo dto.ClientInfo, object dto.NewWishListDto) (*dto.WishListDto, error) {
|
||||
panic("unimplemented")
|
||||
helper, db, err := database.NewDbHelperTransaction(w.dbctx); if err != nil {
|
||||
w.log.Error(
|
||||
"Failed to open transaction",
|
||||
zap.Error(err))
|
||||
return nil, errs.ErrServerError
|
||||
}
|
||||
defer helper.Rollback()
|
||||
|
||||
createdWishList, err := db.TXQueries.CreateWishList(db.CTX, database.CreateWishListParams{
|
||||
Username: cinfo.Username,
|
||||
Hidden: object.Hidden,
|
||||
Name: object.Name,
|
||||
IconName: object.IconName,
|
||||
Color: object.Color,
|
||||
ColorGrad: object.ColorGrad,
|
||||
}); if err != nil {
|
||||
w.log.Error(
|
||||
"Failed to create wish list",
|
||||
zap.String("username", cinfo.Username),
|
||||
zap.Error(err))
|
||||
|
||||
return nil, errs.ErrServerError
|
||||
}
|
||||
|
||||
err = helper.Commit(); if err != nil {
|
||||
w.log.Error(
|
||||
"Failed to commit transaction",
|
||||
zap.Error(err))
|
||||
return nil, errs.ErrServerError
|
||||
}
|
||||
|
||||
wishListDto := &dto.WishListDto{}
|
||||
mapspecial.MapWishListDto(createdWishList, wishListDto)
|
||||
|
||||
return wishListDto, nil
|
||||
}
|
||||
|
||||
func (w wishListServiceImpl) DeleteWishListByGuid(cinfo dto.ClientInfo, guid string) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user