handleDeleteMessages purges SMTP messages, optionally filtered by project.
(store event.Store)
| 155 | |
| 156 | // handleDeleteMessages purges SMTP messages, optionally filtered by project. |
| 157 | func handleDeleteMessages(store event.Store) http.HandlerFunc { |
| 158 | return func(w http.ResponseWriter, r *http.Request) { |
| 159 | project := r.URL.Query().Get("project") |
| 160 | opts := event.DeleteOptions{Type: "smtp", Project: project} |
| 161 | if err := store.DeleteAll(r.Context(), opts); err != nil { |
| 162 | smtpError(w, err.Error(), http.StatusInternalServerError) |
| 163 | return |
| 164 | } |
| 165 | smtpJSON(w, map[string]any{"status": true}) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | // handleStats returns count and last_received_at for SMTP messages. |
| 170 | func handleStats(store event.Store) http.HandlerFunc { |
no test coverage detected