An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
updated DiscordMessages for Database notifications
Jakub Novák53a6e97ca370
diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.phpindex 77024c05bf..ef6128c5f8 100644--- a/app/Notifications/Database/BackupFailed.php+++ b/app/Notifications/Database/BackupFailed.php@@ -3,6 +3,7 @@namespace App\Notifications\Database;use App\Models\ScheduledDatabaseBackup;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -45,9 +46,19 @@ class BackupFailed extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- return "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason:\n{$this->output}";+ $message = new DiscordMessage(+ title: "Coolify: Database backup for {$this->name} (db:{$this->database_name}) has FAILED.",+ description: 'Please check the output below for more information.',+ color: DiscordMessage::errorColor(),+ isCritical: true,+ );++ $message->addField('Frequency', $this->frequency);+ $message->addField('Output', $this->output);++ return $message;}public function toTelegram(): arraydiff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.phpindex f8dc6eb565..fa9eb616c8 100644--- a/app/Notifications/Database/BackupSuccess.php+++ b/app/Notifications/Database/BackupSuccess.php@@ -3,6 +3,7 @@namespace App\Notifications\Database;use App\Models\ScheduledDatabaseBackup;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Messages\MailMessage;@@ -44,9 +45,17 @@ class BackupSuccess extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- return "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was successful.";+ $message = new DiscordMessage(+ title: "Coolify: Database backup for {$this->name} (db:{$this->database_name}) was successful.",+ description: 'Please check the output below for more information.',+ color: DiscordMessage::successColor(),+ );++ $message->addField('Frequency', $this->frequency);++ return $message;}public function toTelegram(): arraydiff --git a/app/Notifications/Database/DailyBackup.php b/app/Notifications/Database/DailyBackup.phpindex a51ac62839..b53a56903c 100644--- a/app/Notifications/Database/DailyBackup.php+++ b/app/Notifications/Database/DailyBackup.php@@ -4,6 +4,7 @@ namespace App\Notifications\Database;use App\Notifications\Channels\DiscordChannel;use App\Notifications\Channels\TelegramChannel;+use App\Notifications\Dto\DiscordMessage;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Notifications\Channels\MailChannel;@@ -34,9 +35,13 @@ class DailyBackup extends Notification implements ShouldQueuereturn $mail;}- public function toDiscord(): string+ public function toDiscord(): DiscordMessage{- return 'Coolify: Daily backup statuses';+ return new DiscordMessage(+ title: 'Coolify: Daily backup statuses',+ description: 'Nothing to report.',+ color: DiscordMessage::infoColor(),+ ); // todo: is this necessary notification? what is the purpose of this notification?}public function toTelegram(): array