Skip to content

Commit f00b522

Browse files
committed
perf: remove images eager load from list and search endpoints
main_image_url is now stored directly on world_heritage_sites, so thumbnail_url resolves from that column without touching world_heritage_site_images. Loading the images relation on every list/search page was a redundant query since the fallback to images[0].url is never reached for sites that have main_image_url populated. The detail endpoint (getHeritageById) retains its full images eager load because it renders the complete image gallery. Closes #465 Part of #463
1 parent e7e30ec commit f00b522

2 files changed

Lines changed: 0 additions & 6 deletions

File tree

src/app/Packages/Domains/WorldHeritageQueryService.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ public function getAllHeritages(
5858
'countries.region',
5959
]);
6060
},
61-
'images' => static function ($imagesQuery): void {
62-
$imagesQuery->where('is_primary', true)->limit(1);
63-
},
6461
'descriptions' => static function ($descriptionsQuery): void {
6562
$descriptionsQuery->select([
6663
'world_heritage_descriptions.world_heritage_site_id',

src/app/Packages/Domains/WorldHeritageReadQueryService.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ public function findByIdsPreserveOrder(array $ids): Collection
4141
$q->select('countries.state_party_code', 'countries.name_en', 'countries.name_jp', 'countries.region')
4242
->orderBy('countries.state_party_code', 'asc');
4343
},
44-
'images' => static function ($imageQuery): void {
45-
$imageQuery->where('is_primary', true)->limit(1);
46-
},
4744
'descriptions' => static function ($descriptionQuery): void {
4845
$descriptionQuery->select([
4946
'world_heritage_descriptions.world_heritage_site_id',

0 commit comments

Comments
 (0)