From f8eb57fc653eaf4bd0be66949e5891e629c4fa5d Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Tue, 5 May 2026 15:12:29 +0900 Subject: [PATCH 1/2] fix: align list DTO with API thumbnail_url field List endpoint returns `thumbnail_url`, but the DTO and mapper read `thumbnail`, so the list VM's thumbnailUrl was always undefined and HeritageCard fell back to the no-image placeholder. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../mappers/__tests__/to-world-heritage-vm.test.ts | 8 ++++---- .../features/heritages/mappers/to-world-heritage-vm.ts | 2 +- .../hooks/__tests__/use-search-heritage-query-test.ts | 2 +- .../search/mapper/__tests__/to-world-heritage-vm.test.ts | 2 +- client/src/app/features/top/apis/index.test.ts | 2 +- client/src/domain/types.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/src/app/features/heritages/mappers/__tests__/to-world-heritage-vm.test.ts b/client/src/app/features/heritages/mappers/__tests__/to-world-heritage-vm.test.ts index 51774b1..e12ca4b 100644 --- a/client/src/app/features/heritages/mappers/__tests__/to-world-heritage-vm.test.ts +++ b/client/src/app/features/heritages/mappers/__tests__/to-world-heritage-vm.test.ts @@ -24,7 +24,7 @@ const base: ApiWorldHeritageDto = { state_party: "JPN", state_party_codes: ["JPN"], state_parties_meta: { JPN: { is_primary: true, inscription_year: 1993 } }, - thumbnail: "https://whc.unesco.org/document/209295/site_0661_0026.jpg", + thumbnail_url: "https://whc.unesco.org/document/209295/site_0661_0026.jpg", }; describe("toWorldHeritageVm", () => { @@ -59,7 +59,7 @@ describe("toWorldHeritageVm", () => { bufferText: "320 ha", statePartyCodes: ["日本"], statePartiesMeta: { JPN: { isPrimary: true, inscriptionYear: 1993 } }, - thumbnailUrl: base.thumbnail, + thumbnailUrl: base.thumbnail_url, images: [], }); @@ -102,8 +102,8 @@ describe("toWorldHeritageVm", () => { expect(vm.bufferText).toBe("—"); }); - it("when thumbnail is null, thumbnailUrl is null", () => { - const vm = toWorldHeritageVm({ ...base, thumbnail: null }, "ja"); + it("when thumbnail_url is null, thumbnailUrl is null", () => { + const vm = toWorldHeritageVm({ ...base, thumbnail_url: null }, "ja"); expect(vm.thumbnailUrl).toBeNull(); }); diff --git a/client/src/app/features/heritages/mappers/to-world-heritage-vm.ts b/client/src/app/features/heritages/mappers/to-world-heritage-vm.ts index f718631..8b90863 100644 --- a/client/src/app/features/heritages/mappers/to-world-heritage-vm.ts +++ b/client/src/app/features/heritages/mappers/to-world-heritage-vm.ts @@ -114,7 +114,7 @@ export function toWorldHeritageVm(data: ApiWorldHeritageDto, locale: Locale): Wo bufferText: fmtHa(data.buffer_zone_hectares), criteriaText: criteriaCodes.join(", "), - thumbnailUrl: data.thumbnail, + thumbnailUrl: data.thumbnail_url, images: [], }; } diff --git a/client/src/app/features/search/hooks/__tests__/use-search-heritage-query-test.ts b/client/src/app/features/search/hooks/__tests__/use-search-heritage-query-test.ts index e38eb43..eb0c5e6 100644 --- a/client/src/app/features/search/hooks/__tests__/use-search-heritage-query-test.ts +++ b/client/src/app/features/search/hooks/__tests__/use-search-heritage-query-test.ts @@ -87,7 +87,7 @@ const OK: ApiSearchResponse = { unesco_site_url: "https://whc.unesco.org/en/list/661", state_party_codes: ["JPN"], state_parties_meta: { JPN: { is_primary: true, inscription_year: 1993 } }, - thumbnail: null, + thumbnail_url: null, }, ], pagination: { current_page: 1, per_page: 30, total: 1, last_page: 1 }, diff --git a/client/src/app/features/search/mapper/__tests__/to-world-heritage-vm.test.ts b/client/src/app/features/search/mapper/__tests__/to-world-heritage-vm.test.ts index d809f7c..29f2002 100644 --- a/client/src/app/features/search/mapper/__tests__/to-world-heritage-vm.test.ts +++ b/client/src/app/features/search/mapper/__tests__/to-world-heritage-vm.test.ts @@ -41,7 +41,7 @@ const makeWorldHeritageDto = ( state_party: null, state_party_codes: ["JP"], state_parties_meta: {}, - thumbnail: null, + thumbnail_url: null, } satisfies ApiWorldHeritageDto; return { ...base, ...overrides }; diff --git a/client/src/app/features/top/apis/index.test.ts b/client/src/app/features/top/apis/index.test.ts index 6bed83b..c332edf 100644 --- a/client/src/app/features/top/apis/index.test.ts +++ b/client/src/app/features/top/apis/index.test.ts @@ -48,7 +48,7 @@ const makeDto = (overrides: Partial = {}): ApiWorldHeritage state_party: null, state_party_codes: ["JPN"], state_parties_meta: {}, - thumbnail: null, + thumbnail_url: null, ...overrides, }); diff --git a/client/src/domain/types.ts b/client/src/domain/types.ts index 17e8179..202e649 100644 --- a/client/src/domain/types.ts +++ b/client/src/domain/types.ts @@ -63,7 +63,7 @@ export type ApiWorldHeritageDto = { state_party: string | null; state_party_codes: string[]; state_parties_meta: StatePartiesMetaDto; - thumbnail: string | null; + thumbnail_url: string | null; }; /** From 9c0f00df8f0c7134e59c87056085e96711e68637 Mon Sep 17 00:00:00 2001 From: Application-drop-up Date: Tue, 5 May 2026 15:50:26 +0900 Subject: [PATCH 2/2] fix: use renamed thumbnail_url field in detail-to-list dto adapter The detail VM mapper synthesizes a list DTO to delegate to toWorldHeritageVm. After the list DTO field rename it still wrote `thumbnail`, which is no longer assignable to ApiWorldHeritageDto. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../features/heritages/mappers/to-world-heritage-detail-vm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/features/heritages/mappers/to-world-heritage-detail-vm.ts b/client/src/app/features/heritages/mappers/to-world-heritage-detail-vm.ts index 5783eb7..a5d0b8f 100644 --- a/client/src/app/features/heritages/mappers/to-world-heritage-detail-vm.ts +++ b/client/src/app/features/heritages/mappers/to-world-heritage-detail-vm.ts @@ -34,7 +34,7 @@ export function toWorldHeritageDetailVm( state_party: dto.state_party, state_party_codes: dto.state_party_codes, state_parties_meta: dto.state_parties_meta, - thumbnail: dto.thumbnail_url, + thumbnail_url: dto.thumbnail_url, } satisfies import("../../../../domain/types.ts").ApiWorldHeritageDto; const base: WorldHeritageVm = toWorldHeritageVm(listDto, locale);