move H to pkg
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user