Skip to content

Commit

Permalink
CompactDTO 에 누락된 Thumbnail (ImageDTO) 추가 (#433)
Browse files Browse the repository at this point in the history
add thumbnail on compact dto
  • Loading branch information
sanggggg authored Nov 23, 2024
1 parent 02a2f91 commit 9bd7e27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,10 @@ components:
type: array
items:
type: string
images:
type: array
items:
$ref: '#/components/schemas/ImageDto'
hasSlope:
type: boolean
floors:
Expand All @@ -1780,6 +1784,7 @@ components:
createdAt:
$ref: '#/components/schemas/EpochMillisTimestamp'
required:
- images
- imageUrls
- hasSlope
- floors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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
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,
Expand All @@ -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()) },
),
Expand All @@ -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) },
)

0 comments on commit 9bd7e27

Please sign in to comment.