Create real Queue counters when specialty modules activate.
Deploy Ladill Care / deploy (push) Successful in 1m39s

Wire module activation to the Queue create/upsert APIs, persist
queue and counter UUIDs on Care stubs, and soft-deactivate on
module off so embedded service counters work without manual setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 16:03:16 +00:00
co-authored by Cursor
parent dec282d25d
commit cd020512c3
5 changed files with 401 additions and 20 deletions
+26 -6
View File
@@ -108,8 +108,13 @@ class ServiceQueuePresenter
}
}
$counters = $this->filterCounters($counters, $branchName, $context);
$stubCounterUuid = collect($stubs)
->map(fn ($s) => (string) ($s['counter_uuid'] ?? ''))
->first(fn ($uuid) => $uuid !== '');
$counters = $this->filterCounters($counters, $branchName, $context, $stubCounterUuid);
$counterUuid = $preferredCounterUuid
?: ($stubCounterUuid ?: '')
?: (string) ($counters[0]['uuid'] ?? '');
if ($counterUuid !== '' && ! collect($counters)->contains(fn ($c) => ($c['uuid'] ?? '') === $counterUuid)) {
@@ -165,11 +170,21 @@ class ServiceQueuePresenter
* @param list<array<string, mixed>> $counters
* @return list<array<string, mixed>>
*/
protected function filterCounters(array $counters, ?string $branchName, string $context): array
{
$keywords = $this->keywordsFor($context);
protected function filterCounters(
array $counters,
?string $branchName,
string $context,
?string $preferredUuid = null,
): array {
$all = collect($counters);
$filtered = $all;
$filtered = collect($counters);
if ($preferredUuid) {
$linked = $all->first(fn ($c) => ($c['uuid'] ?? '') === $preferredUuid);
if ($linked) {
return [$linked];
}
}
if ($branchName) {
$branchFiltered = $filtered->filter(function ($counter) use ($branchName) {
@@ -182,11 +197,16 @@ class ServiceQueuePresenter
}
}
$keywords = $this->keywordsFor($context);
if ($keywords !== []) {
$keywordFiltered = $filtered->filter(function ($counter) use ($keywords) {
$queueNames = collect($counter['queues'] ?? [])->map(function ($q) {
return is_array($q) ? (string) ($q['name'] ?? '') : (string) $q;
})->implode(' ');
$haystack = strtolower(implode(' ', [
(string) ($counter['name'] ?? ''),
collect($counter['queues'] ?? [])->pluck('name')->implode(' '),
$queueNames,
]));
foreach ($keywords as $keyword) {