🚧 process test alert

This commit is contained in:
Fred KISSIE
2026-08-07 20:52:25 +02:00
parent 6689a8d93e
commit 3f305e4d5c
5 changed files with 89 additions and 11 deletions
@@ -0,0 +1,22 @@
import logger from "@server/logger";
import type { TestAlertContext } from "@server/routers/alertRule/types";
import { sendAlertEmail } from "./sendAlertEmail";
export async function processTestAlerts(context: TestAlertContext) {
const emailActions = context.actions.filter(
(action) => action.type === "email"
);
// Process email actions
for (const action of emailActions) {
try {
const recipients = await resolveEmailRecipients(
action.emailActionId
);
if (recipients.length > 0) {
await sendAlertEmail(recipients, context);
}
} catch (err) {
logger.error(`processAlerts: failed to send alert email`, err);
}
}
}