added new endpoint to save product descriptions

This commit is contained in:
Daniel Goc
2026-03-12 12:20:18 +01:00
parent 395c09f7e1
commit 098f559b5f
7 changed files with 159 additions and 23 deletions

View File

@@ -39,6 +39,8 @@ var (
// Typed errors for product description handler
ErrBadAttribute = errors.New("bad attribute")
ErrBadField = errors.New("this field can not be updated")
ErrInvalidHTML = errors.New("text is not in html format")
)
// Error represents an error with HTTP status code
@@ -110,6 +112,10 @@ func GetErrorCode(c fiber.Ctx, err error) string {
case errors.Is(err, ErrBadAttribute):
return i18n.T_(c, "error.err_bad_attribute")
case errors.Is(err, ErrBadField):
return i18n.T_(c, "error.err_bad_field")
case errors.Is(err, ErrInvalidHTML):
return i18n.T_(c, "error.err_invalid_html")
default:
return i18n.T_(c, "error.err_internal_server_error")
@@ -140,7 +146,9 @@ func GetErrorStatus(err error) int {
errors.Is(err, ErrInvalidVerificationToken),
errors.Is(err, ErrVerificationTokenExpired),
errors.Is(err, ErrInvalidPassword),
errors.Is(err, ErrBadAttribute):
errors.Is(err, ErrBadAttribute),
errors.Is(err, ErrBadField),
errors.Is(err, ErrInvalidHTML):
return fiber.StatusBadRequest
case errors.Is(err, ErrEmailExists):
return fiber.StatusConflict