aboutsummaryrefslogtreecommitdiff
path: root/internal/validator/category.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/validator/category.go')
-rw-r--r--internal/validator/category.go13
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