1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Refactor category validation

This commit is contained in:
Frédéric Guillot 2021-01-03 22:28:04 -08:00 committed by fguillot
parent e45cc2d2aa
commit 4468ef1410
13 changed files with 122 additions and 212 deletions

View file

@ -38,7 +38,7 @@ func (h *handler) createFeed(w http.ResponseWriter, r *http.Request) {
return
}
if !h.store.CategoryExists(userID, feedInfo.CategoryID) {
if !h.store.CategoryIDExists(userID, feedInfo.CategoryID) {
json.BadRequest(w, r, errors.New("This category_id doesn't exists or doesn't belongs to this user"))
return
}
@ -123,7 +123,7 @@ func (h *handler) updateFeed(w http.ResponseWriter, r *http.Request) {
feedChanges.Update(originalFeed)
if !h.store.CategoryExists(userID, originalFeed.Category.ID) {
if !h.store.CategoryIDExists(userID, originalFeed.Category.ID) {
json.BadRequest(w, r, errors.New("This category_id doesn't exists or doesn't belongs to this user"))
return
}