From b5351448ed9f5fb8873ca5766499bfa72b830df7 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:50:23 +0100 Subject: [PATCH] feat: Telegram notification settings Model --- app/Models/TelegramNotificationSettings.php | 85 +++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 app/Models/TelegramNotificationSettings.php diff --git a/app/Models/TelegramNotificationSettings.php b/app/Models/TelegramNotificationSettings.php new file mode 100644 index 000000000..2edca14ff --- /dev/null +++ b/app/Models/TelegramNotificationSettings.php @@ -0,0 +1,85 @@ + 'boolean', + 'telegram_token' => 'encrypted', + 'telegram_chat_id' => 'encrypted', + + 'deployment_success_telegram_notifications' => 'boolean', + 'deployment_failure_telegram_notifications' => 'boolean', + 'status_change_telegram_notifications' => 'boolean', + 'backup_success_telegram_notifications' => 'boolean', + 'backup_failure_telegram_notifications' => 'boolean', + 'scheduled_task_success_telegram_notifications' => 'boolean', + 'scheduled_task_failure_telegram_notifications' => 'boolean', + 'docker_cleanup_telegram_notifications' => 'boolean', + 'server_disk_usage_telegram_notifications' => 'boolean', + 'server_reachable_telegram_notifications' => 'boolean', + 'server_unreachable_telegram_notifications' => 'boolean', + + 'telegram_notifications_deployment_success_topic_id' => 'encrypted', + 'telegram_notifications_deployment_failure_topic_id' => 'encrypted', + 'telegram_notifications_status_change_topic_id' => 'encrypted', + 'telegram_notifications_backup_success_topic_id' => 'encrypted', + 'telegram_notifications_backup_failure_topic_id' => 'encrypted', + 'telegram_notifications_scheduled_task_success_topic_id' => 'encrypted', + 'telegram_notifications_scheduled_task_failure_topic_id' => 'encrypted', + 'telegram_notifications_docker_cleanup_topic_id' => 'encrypted', + 'telegram_notifications_server_disk_usage_topic_id' => 'encrypted', + 'telegram_notifications_server_reachable_topic_id' => 'encrypted', + 'telegram_notifications_server_unreachable_topic_id' => 'encrypted', + ]; + + public function team() + { + return $this->belongsTo(Team::class); + } + + public function isEnabled() + { + return $this->telegram_enabled; + } +}