From ebb7cba53df1956c7320d152d5526fc8a03b8af9 Mon Sep 17 00:00:00 2001 From: Agent Date: Sat, 13 Jun 2026 16:23:20 -0400 Subject: [PATCH] send FCM push for threshold breach notifications --- src/Controllers/ApiController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php index ad72bd3..f32d39a 100755 --- a/src/Controllers/ApiController.php +++ b/src/Controllers/ApiController.php @@ -453,16 +453,18 @@ class ApiController if (!empty($breaches)) { $userIds = $serverModel->getAccessibleUserIds((int) $server['id']); $notificationModel = new Notification(); + $fcm = new FCMService(); foreach ($breaches as $b) { $title = strtoupper($b['metric']) . " {$b['level']} on {$server['name']}"; $message = "{$server['name']}: {$b['metric']} at {$b['current']}% ({$b['level']} threshold: {$b['threshold']}%)"; foreach ($userIds as $uid) { - $notificationModel->create([ + $noteId = $notificationModel->create([ 'user_id' => (int) $uid, 'title' => $title, 'message' => $message, 'type' => $b['level'], ]); + $fcm->sendToUser((int) $uid, $title, $message, $b['level'], $noteId); } } }