From fb188fd302fec17280250cd3b615a96b6ae2463d Mon Sep 17 00:00:00 2001 From: cproudlock Date: Wed, 22 Jul 2026 13:32:00 -0400 Subject: [PATCH] alerts: per-support-team webhook; printedparts routes low-stock to a chosen team Support teams gain a webhookurl (migration 7d29 + API + settings-page field), so a team is a notification target. send_webhook(url=) lets a caller override the site default with a team's webhook. Printedparts gains a 'alert support team' setting (printedparts_alert_supportteamid) + selector on its settings page; low-stock alerts post to that team's webhook, falling back to the site alert_webhook_url. Email leg unchanged. Same pattern extends to other alerting plugins (printers low-toner next). --- .../src/views/settings/SupportTeamsList.vue | 13 ++++-- .../versions/7d29_supportteam_webhookurl.py | 41 +++++++++++++++++++ plugins/printedparts/api/routes.py | 37 +++++++++++++---- .../frontend/views/PrintedPartsSettings.vue | 25 +++++++++-- plugins/printedparts/plugin.py | 3 ++ shopdb/core/api/supportteams.py | 3 +- shopdb/core/models/supportteam.py | 3 ++ shopdb/utils/mailer.py | 14 ++++--- .../test_plugins/test_printedparts_ledger.py | 24 +++++++++++ 9 files changed, 142 insertions(+), 21 deletions(-) create mode 100644 migrations/versions/7d29_supportteam_webhookurl.py diff --git a/frontend/src/views/settings/SupportTeamsList.vue b/frontend/src/views/settings/SupportTeamsList.vue index ec14e1d..006543e 100644 --- a/frontend/src/views/settings/SupportTeamsList.vue +++ b/frontend/src/views/settings/SupportTeamsList.vue @@ -63,6 +63,10 @@ +
+ + +
{{ teamError }}
+
+ + +

+ Low-stock alerts post to this team's webhook (set on Settings > + Support Teams). Empty uses the site-wide alert webhook. +

+
+ @@ -85,7 +99,7 @@