Incomplete implementation of createVotes

This commit is contained in:
2025-01-02 19:24:32 +01:00
parent 9efe9a3537
commit 0229f78976
9 changed files with 136 additions and 13 deletions

View File

@ -43,6 +43,15 @@ func (app *application) unprocessableEntityError(w http.ResponseWriter, v valida
json.NewEncoder(w).Encode(response)
}
func (app *application) unprocessableEntityErrorSingle(w http.ResponseWriter, err error) {
w.WriteHeader(http.StatusUnprocessableEntity)
var response = api.ErrorResponse{
Code: http.StatusUnprocessableEntity,
Message: err.Error(),
}
json.NewEncoder(w).Encode(response)
}
func (app *application) unmarshalRequest(r *http.Request, dst any) error {
body, err := io.ReadAll(r.Body)
if err != nil {