Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-15 18:56:39 +02:00
parent 1349789226
commit fb076c174f
117 changed files with 10380 additions and 1905 deletions
+24
View File
@@ -245,6 +245,30 @@ final class InvestmentGeography
return $path;
}
/** Canonical selection for a place-of-interest filter, including legacy links.
* @param array<string,mixed> $filters
* @return array<string,mixed>
*/
public function interestSelection(array $filters): array
{
$location = \Illuminate\Support\Facades\Validator::make($filters, ['territory' => 'nullable|uuid', 'province_id' => 'nullable|uuid', 'district_id' => 'nullable|uuid', 'admin_post_id' => 'nullable|uuid', 'locality_id' => 'nullable|uuid'])->validate();
if (array_intersect(array_keys(self::FIELDS), array_keys($location))) {
$path = $this->selection($location);
$territory = $path ? $path[array_key_last($path)]->id : null;
if (! empty($location['territory']) && $location['territory'] !== $territory) {
throw ValidationException::withMessages(['territory' => 'O local de interesse não corresponde à hierarquia seleccionada.']);
}
if ($territory) $filters['territory'] = $territory;
else unset($filters['territory']);
}
if (! empty($filters['territory'])) {
$path = $this->path($filters['territory']);
if (! $path) throw ValidationException::withMessages(['territory' => 'Seleccione um local disponível no cadastro.']);
foreach ($path as $node) $filters[$node->location_type.'_id'] = $node->id;
}
return $filters;
}
/** @return list<string> */
public function descendants(string $id, bool $includeNonPublic = false): array
{