move H to pkg

This commit is contained in:
2025-10-30 17:50:03 +01:00
parent 145028af37
commit 84ec54a893
5 changed files with 19 additions and 23 deletions
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"log/slog"
"net/http"
"pkg"
"serviceb/internal/app"
)
type Handler struct {
@@ -32,14 +31,14 @@ func (h *Handler) GetMeteoData(w http.ResponseWriter, r *http.Request) {
if err := params.Validate(); err != nil {
slog.Error("error validating struct", "error", err)
h.ToJSON(w, http.StatusBadRequest, app.H{"error": err.Error()})
h.ToJSON(w, http.StatusBadRequest, pkg.H{"error": err.Error()})
return
}
data, err := h.s.GetWeatherByCity(r.Context(), params)
if err != nil {
slog.Error("error", "err", err)
h.ToJSON(w, http.StatusInternalServerError, app.H{"error": err})
h.ToJSON(w, http.StatusInternalServerError, pkg.H{"error": err})
return
}