Adding a notification channel
Send alerts somewhere new.
A channel is a config struct and a send function in crates/alerts, plus a
form in the frontend. The server and database need no changes.
-
Write the sender. Add a module in
crates/alerts/src/with a config struct, avalidate()method, andsend(config, &Alert) -> Result<(), String>. Use the sharedclient(), which sets the timeout, andensure_success()to turn a non-2xx response into an error.Alertprovidestitle(),details()andtext()for the message. -
Register it in
crates/alerts/src/lib.rs: add the module, a variant toChannelConfig(its kebab-case name becomes thetypevalue), and arms tovalidateandsend. -
Add the form. In
frontend/src/routes/(dashboard)/notifications/channel-form.svelte, add the type tochannelTypes, its fields, its config inbuildConfig(), and the prefill for editing. Add its label totypeLabelsinnotifications/+page.svelte. -
Test and document it. Add tests in the module, and the channel to Alerts and Alert payloads.