BulkDelete handles POST /alerts/bulk-delete.
(w http.ResponseWriter, r *http.Request)
| 276 | |
| 277 | // BulkDelete handles POST /alerts/bulk-delete. |
| 278 | func (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. |
| 298 | func (h *AlertsHandler) BulkAction(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected