From e2804ca07e2b81d8208589384de9833121ba6a27 Mon Sep 17 00:00:00 2001 From: Kharec Date: Sat, 10 Jan 2026 23:01:15 +0100 Subject: [PATCH] refactor: use GetValidatedDTO for vote validation --- internal/handlers/vote_handler.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/handlers/vote_handler.go b/internal/handlers/vote_handler.go index 1addd10..2e83873 100644 --- a/internal/handlers/vote_handler.go +++ b/internal/handlers/vote_handler.go @@ -78,14 +78,13 @@ func (h *VoteHandler) CastVote(w http.ResponseWriter, r *http.Request) { return } - req, ok := GetValidatedDTO[dto.CastVoteRequest](r) + request, ok := GetValidatedDTO[dto.CastVoteRequest](w, r) if !ok { - SendErrorResponse(w, "Invalid request", http.StatusBadRequest) return } var voteType database.VoteType - switch req.Type { + switch request.Type { case "up": voteType = database.VoteUp case "down":