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

Method BulkDelete

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

BulkDelete handles POST /alerts/bulk-delete.

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

Source from the content-addressed store, hash-verified

276
277// BulkDelete handles POST /alerts/bulk-delete.
278func (h *AlertsHandler) BulkDelete(w http.ResponseWriter, r *http.Request) {
279 var req struct {
280 AlertIDs []string `json:"alertIds"`
281 }
282 if err := decodeJSON(r, &req); err != nil {
283 Error(w, http.StatusBadRequest, "Invalid request body")
284 return
285 }
286 if len(req.AlertIDs) == 0 {
287 Error(w, http.StatusBadRequest, "alertIds required")
288 return
289 }
290 if err := h.alerts.BulkDelete(r.Context(), req.AlertIDs); err != nil {
291 Error(w, http.StatusInternalServerError, "Failed to delete alerts")
292 return
293 }
294 successData(w, map[string]interface{}{"deleted": len(req.AlertIDs)})
295}
296
297// BulkAction handles POST /alerts/bulk-action.
298func (h *AlertsHandler) BulkAction(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 3

decodeJSONFunction · 0.85
ErrorFunction · 0.85
successDataFunction · 0.85

Tested by

no test coverage detected