refactor: remove redundant validation and unused import
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
|||||||
"goyco/internal/repositories"
|
"goyco/internal/repositories"
|
||||||
"goyco/internal/security"
|
"goyco/internal/security"
|
||||||
"goyco/internal/services"
|
"goyco/internal/services"
|
||||||
"goyco/internal/validation"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/jackc/pgconn"
|
"github.com/jackc/pgconn"
|
||||||
@@ -273,16 +272,6 @@ func (h *PostHandler) UpdatePost(w http.ResponseWriter, r *http.Request) {
|
|||||||
title := security.SanitizeInput(req.Title)
|
title := security.SanitizeInput(req.Title)
|
||||||
content := security.SanitizePostContent(req.Content)
|
content := security.SanitizePostContent(req.Content)
|
||||||
|
|
||||||
if err := validation.ValidateTitle(title); err != nil {
|
|
||||||
SendErrorResponse(w, err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := validation.ValidateContent(content); err != nil {
|
|
||||||
SendErrorResponse(w, err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
post.Title = title
|
post.Title = title
|
||||||
post.Content = content
|
post.Content = content
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user