From 9bd7e2708e800175a94afa38a27200dde9c5bba7 Mon Sep 17 00:00:00 2001 From: sanggggg <37951125+sanggggg@users.noreply.github.com> Date: Sat, 23 Nov 2024 17:31:34 +0900 Subject: [PATCH] =?UTF-8?q?CompactDTO=20=EC=97=90=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EB=90=9C=20Thumbnail=20(ImageDTO)=20=EC=B6=94=EA=B0=80=20(#433?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add thumbnail on compact dto --- .../api_specification/api/scc-api/api-spec.yaml | 5 +++++ .../infra/adapter/in/controller/Converters.kt | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml b/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml index ee28efa56..bcd51c6b0 100644 --- a/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml +++ b/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml @@ -1771,6 +1771,10 @@ components: type: array items: type: string + images: + type: array + items: + $ref: '#/components/schemas/ImageDto' hasSlope: type: boolean floors: @@ -1780,6 +1784,7 @@ components: createdAt: $ref: '#/components/schemas/EpochMillisTimestamp' required: + - images - imageUrls - hasSlope - floors diff --git a/app-server/subprojects/bounded_context/place_search/infra/src/main/kotlin/club/staircrusher/place_search/infra/adapter/in/controller/Converters.kt b/app-server/subprojects/bounded_context/place_search/infra/src/main/kotlin/club/staircrusher/place_search/infra/adapter/in/controller/Converters.kt index dce65dc2f..c9c8c734e 100644 --- a/app-server/subprojects/bounded_context/place_search/infra/src/main/kotlin/club/staircrusher/place_search/infra/adapter/in/controller/Converters.kt +++ b/app-server/subprojects/bounded_context/place_search/infra/src/main/kotlin/club/staircrusher/place_search/infra/adapter/in/controller/Converters.kt @@ -1,5 +1,6 @@ package club.staircrusher.place_search.infra.adapter.`in`.controller +import club.staircrusher.accessibility.domain.model.AccessibilityImage import club.staircrusher.api.converter.toDTO import club.staircrusher.api.spec.dto.EpochMillisTimestamp import club.staircrusher.api.spec.dto.PlaceCategoryDto @@ -7,6 +8,7 @@ import club.staircrusher.api.spec.dto.PlaceListItem import club.staircrusher.place.domain.model.Building import club.staircrusher.place.domain.model.Place import club.staircrusher.place_search.application.port.`in`.PlaceSearchService +import club.staircrusher.spring_web.cdn.SccCdn fun Place.toDTO(isFavorite: Boolean) = club.staircrusher.api.spec.dto.Place( id = id, @@ -33,6 +35,7 @@ fun PlaceSearchService.SearchPlacesResult.toDTO() = PlaceListItem( accessibilityScore = accessibilityScore, floors = placeAccessibility?.floors ?: emptyList(), hasSlope = placeAccessibility?.hasSlope ?: false, + images = placeAccessibility?.images?.map { it.toDTO() } ?: emptyList(), imageUrls = placeAccessibility?.imageUrls ?: emptyList(), createdAt = placeAccessibility?.createdAt?.let { EpochMillisTimestamp(it.toEpochMilli()) }, ), @@ -59,3 +62,8 @@ fun club.staircrusher.stdlib.place.PlaceCategory.toDto(): PlaceCategoryDto = whe club.staircrusher.stdlib.place.PlaceCategory.HOSPITAL -> PlaceCategoryDto.HOSPITAL club.staircrusher.stdlib.place.PlaceCategory.PHARMACY -> PlaceCategoryDto.PHARMACY } + +fun AccessibilityImage.toDTO() = club.staircrusher.api.spec.dto.ImageDto( + imageUrl = SccCdn.forAccessibilityImage(imageUrl), + thumbnailUrl = thumbnailUrl?.let { SccCdn.forAccessibilityImage(it) }, +)