From a181b7b8b889fd0032b619499bc38902acf1de73 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 26 Sep 2025 17:06:06 -0300 Subject: [PATCH] feat(notifications): add custom notification support for database backup status --- .../utils/notifications/database-backup.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utils/notifications/database-backup.ts b/packages/server/src/utils/notifications/database-backup.ts index f3c5cd5f4..24e77e1bf 100644 --- a/packages/server/src/utils/notifications/database-backup.ts +++ b/packages/server/src/utils/notifications/database-backup.ts @@ -5,6 +5,7 @@ import { renderAsync } from "@react-email/components"; import { format } from "date-fns"; import { and, eq } from "drizzle-orm"; import { + sendCustomNotification, sendDiscordNotification, sendEmailNotification, sendGotifyNotification, @@ -44,11 +45,12 @@ export const sendDatabaseBackupNotifications = async ({ slack: true, gotify: true, ntfy: true, + custom: true, }, }); for (const notification of notificationList) { - const { email, discord, telegram, slack, gotify, ntfy } = notification; + const { email, discord, telegram, slack, gotify, ntfy, custom } = notification; if (email) { const template = await renderAsync( @@ -238,5 +240,21 @@ export const sendDatabaseBackupNotifications = async ({ ], }); } + + if (custom) { + await sendCustomNotification(custom, { + title: `Database Backup ${type === "success" ? "Successful" : "Failed"}`, + message: type === "success" ? "Database backup completed successfully" : "Database backup failed", + projectName, + applicationName, + databaseType, + databaseName, + type, + errorMessage: errorMessage || "", + timestamp: date.toISOString(), + date: date.toLocaleString(), + status: type, + }); + } } };