diff options
author | 2023-10-21 19:50:29 -0700 | |
---|---|---|
committer | 2023-10-22 13:09:30 -0700 | |
commit | 14e25ab9fe09b9951b38e56af2bdff7a0737b280 (patch) | |
tree | 1e466305ccf868d0253b09895af29f811a3e3393 /internal/validator/category.go | |
parent | 120aabfbcef4ef453d70861aece3b107b603a911 (diff) | |
download | v2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.tar.gz v2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.tar.zst v2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.zip |
Refactor HTTP Client and LocalizedError packages
Diffstat (limited to 'internal/validator/category.go')
-rw-r--r-- | internal/validator/category.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/validator/category.go b/internal/validator/category.go index 54d74078..7be076db 100644 --- a/internal/validator/category.go +++ b/internal/validator/category.go @@ -4,31 +4,32 @@ package validator // import "miniflux.app/v2/internal/validator" import ( + "miniflux.app/v2/internal/locale" "miniflux.app/v2/internal/model" "miniflux.app/v2/internal/storage" ) // ValidateCategoryCreation validates category creation. -func ValidateCategoryCreation(store *storage.Storage, userID int64, request *model.CategoryRequest) *ValidationError { +func ValidateCategoryCreation(store *storage.Storage, userID int64, request *model.CategoryRequest) *locale.LocalizedError { if request.Title == "" { - return NewValidationError("error.title_required") + return locale.NewLocalizedError("error.title_required") } if store.CategoryTitleExists(userID, request.Title) { - return NewValidationError("error.category_already_exists") + return locale.NewLocalizedError("error.category_already_exists") } return nil } // ValidateCategoryModification validates category modification. -func ValidateCategoryModification(store *storage.Storage, userID, categoryID int64, request *model.CategoryRequest) *ValidationError { +func ValidateCategoryModification(store *storage.Storage, userID, categoryID int64, request *model.CategoryRequest) *locale.LocalizedError { if request.Title == "" { - return NewValidationError("error.title_required") + return locale.NewLocalizedError("error.title_required") } if store.AnotherCategoryExists(userID, categoryID, request.Title) { - return NewValidationError("error.category_already_exists") + return locale.NewLocalizedError("error.category_already_exists") } return nil |