feat: use new notification event names

This commit is contained in:
peaklabs-dev
2024-12-09 16:57:15 +01:00
parent bc726ddd6e
commit b6500142c4
12 changed files with 75 additions and 150 deletions

View File

@@ -5,8 +5,8 @@ namespace App\Notifications\Database;
use App\Models\ScheduledDatabaseBackup;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
use Illuminate\Notifications\Messages\MailMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Notifications\Messages\MailMessage;
class BackupFailed extends CustomEmailNotification
{
@@ -23,13 +23,13 @@ class BackupFailed extends CustomEmailNotification
public function via(object $notifiable): array
{
return setNotificationChannels($notifiable, 'database_backups');
return $notifiable->getEnabledChannels('backup_failure');
}
public function toMail(): MailMessage
{
$mail = new MailMessage;
$mail->subject("Coolify: [ACTION REQUIRED] Backup FAILED for {$this->database->name}");
$mail->subject("Coolify: [ACTION REQUIRED] Database Backup FAILED for {$this->database->name}");
$mail->view('emails.backup-failed', [
'name' => $this->name,
'database_name' => $this->database_name,
@@ -66,7 +66,7 @@ class BackupFailed extends CustomEmailNotification
public function toSlack(): SlackMessage
{
$title = "Database backup failed";
$title = 'Database backup failed';
$description = "Database backup for {$this->name} (db:{$this->database_name}) has FAILED.";
$description .= "\n\n**Frequency:** {$this->frequency}";

View File

@@ -5,8 +5,8 @@ namespace App\Notifications\Database;
use App\Models\ScheduledDatabaseBackup;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
use Illuminate\Notifications\Messages\MailMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Notifications\Messages\MailMessage;
class BackupSuccess extends CustomEmailNotification
{
@@ -24,7 +24,7 @@ class BackupSuccess extends CustomEmailNotification
public function via(object $notifiable): array
{
return setNotificationChannels($notifiable, 'database_backups');
return $notifiable->getEnabledChannels('backup_success');
}
public function toMail(): MailMessage
@@ -64,7 +64,7 @@ class BackupSuccess extends CustomEmailNotification
public function toSlack(): SlackMessage
{
$title = "Database backup successful";
$title = 'Database backup successful';
$description = "Database backup for {$this->name} (db:{$this->database_name}) was successful.";
$description .= "\n\n**Frequency:** {$this->frequency}";