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, + }); + } } };