GetByID handles GET /alerts/:id.
(w http.ResponseWriter, r *http.Request)
| 79 | |
| 80 | // GetByID handles GET /alerts/:id. |
| 81 | func (h *AlertsHandler) GetByID(w http.ResponseWriter, r *http.Request) { |
| 82 | id := chi.URLParam(r, "id") |
| 83 | if id == "" { |
| 84 | Error(w, http.StatusBadRequest, "Alert ID required") |
| 85 | return |
| 86 | } |
| 87 | alert, err := h.alerts.GetByID(r.Context(), id) |
| 88 | if err != nil { |
| 89 | Error(w, http.StatusNotFound, "Alert not found") |
| 90 | return |
| 91 | } |
| 92 | successData(w, alert) |
| 93 | } |
| 94 | |
| 95 | // GetHistory handles GET /alerts/:id/history. |
| 96 | func (h *AlertsHandler) GetHistory(w http.ResponseWriter, r *http.Request) { |
no test coverage detected