feat: per-server notification thresholds with alert on agent metrics push

This commit is contained in:
2026-06-13 16:12:36 -04:00
parent b6c7275437
commit c63c5ffcfd
8 changed files with 181 additions and 1 deletions

View File

@@ -410,6 +410,28 @@ class Server
);
}
public function getAccessibleUserIds(int $serverId): array
{
$direct = $this->db->fetchCol(
'SELECT user_id FROM server_user WHERE server_id = ? AND status = \'active\'',
[$serverId]
);
$team = $this->db->fetchCol(
'SELECT DISTINCT tu.user_id FROM team_user tu
JOIN team_server ts ON tu.team_id = ts.team_id
WHERE ts.server_id = ? AND tu.status = \'active\' AND ts.status = \'active\'',
[$serverId]
);
$owner = $this->db->fetchCol(
'SELECT created_by FROM servers WHERE id = ? AND status = \'active\'',
[$serverId]
);
return array_unique(array_merge($direct, $team, $owner));
}
public function findByAgentKey(string $key): ?array
{
$server = $this->db->fetch(