SquatchMail.Web.ActivityExportController (SquatchMail v0.1.0)

Copy Markdown View Source

Streams the Trail Log's current filter set as a CSV download — GET <dashboard_path>/activity/export.csv.

Accepts the same query params the Trail Log LiveView patches into its own URL (status, q, or range as one of 24h/7d/30d/all), so "Export CSV" always downloads exactly what's on screen — see SquatchMail.Web.Live.TrailLog.filters_from_params/1, the single source of truth both this controller and the LiveView build Tracker filters from. Rows are streamed with Plug.Conn.chunk/2 rather than built as one giant binary, so a large export doesn't hold the whole CSV in memory at once.

This is a plain Plug (same pattern as SquatchMail.Web.AssetController and SquatchMail.Web.WebhookController) — a CSV download needs no view/format negotiation.