diff --git a/packages/server/src/emails/emails/dokploy-backup.tsx b/packages/server/src/emails/emails/dokploy-backup.tsx index ea2246eb6..327a02a5b 100644 --- a/packages/server/src/emails/emails/dokploy-backup.tsx +++ b/packages/server/src/emails/emails/dokploy-backup.tsx @@ -1,105 +1,106 @@ import { - Body, - Container, - Head, - Heading, - Html, - Img, - Preview, - Section, - Tailwind, - Text, + Body, + Container, + Head, + Heading, + Html, + Img, + Preview, + Section, + Tailwind, + Text, } from "@react-email/components"; export type TemplateProps = { - type: "error" | "success"; - errorMessage?: string; - date: string; - backupSize?: string; + type: "error" | "success"; + errorMessage?: string; + date: string; + backupSize?: string; }; export const DokployBackupEmail = ({ - type = "success", - errorMessage, - date = "2023-05-01T00:00:00.000Z", - backupSize, + type = "success", + errorMessage, + date = "2023-05-01T00:00:00.000Z", + backupSize, }: TemplateProps) => { - const previewText = `Dokploy instance backup was ${type === "success" ? "successful ✅" : "failed ❌"}`; - - return ( - - {previewText} - - - - -
- Dokploy -
- - Dokploy Instance Backup - - - Hello, - - - Your Dokploy instance backup was{" "} - {type === "success" - ? "successful ✅" - : "failed. Please check the error message below. ❌"} - . - -
- Details: - - Backup Type: Complete Dokploy Instance - - - Content: /etc/dokploy + PostgreSQL Database - - {backupSize && ( - - Backup Size: {backupSize} - - )} - - Date: {date} - - - Status: {type === "success" ? "Successful" : "Failed"} - -
- {type === "error" && errorMessage ? ( -
- Reason: - - {errorMessage || "Error message not provided"} - -
- ) : null} -
- -
- - ); + const previewText = `Dokploy instance backup was ${type === "success" ? "successful ✅" : "failed ❌"}`; + + return ( + + {previewText} + + + + +
+ Dokploy +
+ + Dokploy Instance Backup + + + Hello, + + + Your Dokploy instance backup was{" "} + {type === "success" + ? "successful ✅" + : "failed. Please check the error message below. ❌"} + . + +
+ Details: + + Backup Type: Complete Dokploy Instance + + + Content: /etc/dokploy + PostgreSQL Database + + {backupSize && ( + + Backup Size: {backupSize} + + )} + + Date: {date} + + + Status:{" "} + {type === "success" ? "Successful" : "Failed"} + +
+ {type === "error" && errorMessage ? ( +
+ Reason: + + {errorMessage || "Error message not provided"} + +
+ ) : null} +
+ +
+ + ); }; -export default DokployBackupEmail; \ No newline at end of file +export default DokployBackupEmail; diff --git a/packages/server/src/utils/backups/web-server.ts b/packages/server/src/utils/backups/web-server.ts index 04c35ed46..19dd44eed 100644 --- a/packages/server/src/utils/backups/web-server.ts +++ b/packages/server/src/utils/backups/web-server.ts @@ -124,11 +124,11 @@ export const runWebServerBackup = async (backup: BackupSchedule) => { ); writeStream.end(); await sendDokployBackupNotifications({ - type: "error", - // @ts-ignore - errorMessage: error?.message || "Error message not provided", - backupSize: formatBytes(computedBackupSize), - }); + type: "error", + // @ts-ignore + errorMessage: error?.message || "Error message not provided", + backupSize: formatBytes(computedBackupSize), + }); await updateDeploymentStatus(deployment.deploymentId, "error"); throw error; } diff --git a/packages/server/src/utils/notifications/dokploy-backup.ts b/packages/server/src/utils/notifications/dokploy-backup.ts index 707f53839..580dd1baa 100644 --- a/packages/server/src/utils/notifications/dokploy-backup.ts +++ b/packages/server/src/utils/notifications/dokploy-backup.ts @@ -51,11 +51,7 @@ export const sendDokployBackupNotifications = async ({ backupSize, }), ).catch(); - await sendEmailNotification( - email, - "Dokploy instance backup", - template, - ); + await sendEmailNotification(email, "Dokploy instance backup", template); } if (discord) { @@ -319,4 +315,4 @@ export const sendDokployBackupNotifications = async ({ }); } } -}; \ No newline at end of file +};