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

Method List

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

List handles GET /alerts.

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

Source from the content-addressed store, hash-verified

29
30// List handles GET /alerts.
31func (h *AlertsHandler) List(w http.ResponseWriter, r *http.Request) {
32 var assignedTo *string
33 if r.URL.Query().Get("assignedToMe") == "true" {
34 userID, _ := r.Context().Value(middleware.UserIDKey).(string)
35 if userID != "" {
36 assignedTo = &userID
37 }
38 }
39 alerts, err := h.alerts.List(r.Context(), assignedTo)
40 if err != nil {
41 Error(w, http.StatusInternalServerError, "Failed to fetch alerts")
42 return
43 }
44 successData(w, alerts)
45}
46
47// GetStats handles GET /alerts/stats.
48func (h *AlertsHandler) GetStats(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 5

ErrorFunction · 0.85
successDataFunction · 0.85
QueryMethod · 0.80
GetMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected