MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / GetByID

Method GetByID

server-source-code/internal/handler/alerts.go:81–93  ·  view source on GitHub ↗

GetByID handles GET /alerts/:id.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

79
80// GetByID handles GET /alerts/:id.
81func (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.
96func (h *AlertsHandler) GetHistory(w http.ResponseWriter, r *http.Request) {

Callers 3

PerformActionMethod · 0.45
AssignMethod · 0.45
UnassignMethod · 0.45

Calls 2

ErrorFunction · 0.85
successDataFunction · 0.85

Tested by

no test coverage detected