Files
coolify/app/Events/V5ClusterUpdated.php
Andras Bacsai 6ae45684f9 feat(v5): add server reconciliation and canvas APIs
Split V5 dashboard behavior into domain controllers and policies,
add agent token rotation/revocation, status reconciliation jobs,
ingress firewall syncing, and canvas connection APIs.

Add migrations for V5 status tracking, server capabilities, resource
connection aliases, and revoked agent tokens.
2026-07-06 17:40:37 +02:00

55 lines
1.5 KiB
PHP

<?php
namespace App\Events;
use App\Models\V5\Cluster as V5Cluster;
use App\Support\V5\ClusterSerializer;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class V5ClusterUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Push the queued broadcast job only after the dispatching database
* transaction commits, so workers never serialize pre-commit state.
*/
public bool $afterCommit = true;
public function __construct(public int $teamId, public int $clusterId) {}
public function broadcastOn(): array
{
return [
new PrivateChannel("team.{$this->teamId}"),
];
}
public function broadcastAs(): string
{
return 'v5.cluster.updated';
}
/**
* @return array{cluster: array<string, mixed>|null}
*/
public function broadcastWith(): array
{
$cluster = V5Cluster::query()
->where('team_id', $this->teamId)
->with(['servers' => fn ($query) => $query
->with('privateKey')
->orderBy('name')])
->withCount('servers')
->find($this->clusterId);
return [
'cluster' => $cluster instanceof V5Cluster ? app(ClusterSerializer::class)->serialize($cluster) : null,
];
}
}