mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-13 07:25:17 +00:00
feat(notifications): add custom notification support for database backup status
This commit is contained in:
@@ -5,6 +5,7 @@ import { renderAsync } from "@react-email/components";
|
|||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
@@ -44,11 +45,12 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
slack: true,
|
slack: true,
|
||||||
gotify: true,
|
gotify: true,
|
||||||
ntfy: true,
|
ntfy: true,
|
||||||
|
custom: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const notification of notificationList) {
|
for (const notification of notificationList) {
|
||||||
const { email, discord, telegram, slack, gotify, ntfy } = notification;
|
const { email, discord, telegram, slack, gotify, ntfy, custom } = notification;
|
||||||
|
|
||||||
if (email) {
|
if (email) {
|
||||||
const template = await renderAsync(
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user