Align quick search with current financial directory while retaining historical records
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -56,7 +56,7 @@ class GlobalSearchController extends Controller
|
|||||||
if (! $service->installed()) {
|
if (! $service->installed()) {
|
||||||
return ['count' => 0, 'fetch' => fn ($offset, $limit) => []];
|
return ['count' => 0, 'fetch' => fn ($offset, $limit) => []];
|
||||||
}
|
}
|
||||||
$query = $service->publicQuery()->select('p.id', 'v.payload')->selectRaw("v.payload->>'title' AS title");
|
$query = $service->catalogueQuery([])->select('p.id', 'v.payload')->selectRaw("v.payload->>'title' AS title");
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
$query->where(function ($match) use ($search, $token) {
|
$query->where(function ($match) use ($search, $token) {
|
||||||
$search->orFields($match, ["(v.payload->>'title')",
|
$search->orFields($match, ["(v.payload->>'title')",
|
||||||
|
|||||||
@@ -56,11 +56,12 @@ final class GlobalSearchCountTest extends TestCase
|
|||||||
}
|
}
|
||||||
$actor = User::factory()->create();
|
$actor = User::factory()->create();
|
||||||
$marker = 'SYNTHFIN'.Str::random(8);
|
$marker = 'SYNTHFIN'.Str::random(8);
|
||||||
foreach (['published', 'draft', 'future'] as $state) {
|
foreach (['published', 'draft', 'future', 'historical', 'merged'] as $state) {
|
||||||
$id = (string) Str::uuid();
|
$id = (string) Str::uuid();
|
||||||
$version = (string) Str::uuid();
|
$version = (string) Str::uuid();
|
||||||
$payload = json_encode(['title' => $marker.' '.$state, 'kind' => 'institution', 'summary' => 'Nota de preparação: ficha e documento gerador.',
|
$payload = json_encode(['title' => $marker.' '.$state, 'kind' => 'institution', 'summary' => 'Nota de preparação: ficha e documento gerador.',
|
||||||
'institution_nature' => 'bank', 'institution_services' => ['investment'],
|
'institution_nature' => 'bank', 'institution_services' => ['investment'],
|
||||||
|
'institution_status' => in_array($state, ['historical', 'merged'], true) ? $state : 'reported',
|
||||||
'locations' => [['location_text' => 'Nampula']], 'products' => [['title' => 'Crédito PME', 'coverage' => 'national', 'needs' => ['investment']]]], JSON_THROW_ON_ERROR);
|
'locations' => [['location_text' => 'Nampula']], 'products' => [['title' => 'Crédito PME', 'coverage' => 'national', 'needs' => ['investment']]]], JSON_THROW_ON_ERROR);
|
||||||
DB::table('funding_programmes')->insert(['id' => $id, 'code' => $marker.$state, 'draft' => $payload, 'created_by' => $actor->id]);
|
DB::table('funding_programmes')->insert(['id' => $id, 'code' => $marker.$state, 'draft' => $payload, 'created_by' => $actor->id]);
|
||||||
DB::table('funding_programme_versions')->insert(['id' => $version, 'programme_id' => $id, 'version' => 1, 'payload' => $payload,
|
DB::table('funding_programme_versions')->insert(['id' => $version, 'programme_id' => $id, 'version' => 1, 'payload' => $payload,
|
||||||
|
|||||||
Reference in New Issue
Block a user