From b9b86737ba6a02ef6e81bc1eda471834095f87ff Mon Sep 17 00:00:00 2001 From: Diger Date: Fri, 6 Sep 2024 00:58:40 +0900 Subject: [PATCH] hotfix: Lemon/Avocado Response Format to Nullable --- .../adapter/AvocadoPlaceInfoResponse.kt | 6 ++-- .../lemon/adapter/LemonPlaceInfoResponse.kt | 36 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/piikii-output-web/avocado/src/main/kotlin/com/piikii/output/web/avocado/adapter/AvocadoPlaceInfoResponse.kt b/piikii-output-web/avocado/src/main/kotlin/com/piikii/output/web/avocado/adapter/AvocadoPlaceInfoResponse.kt index 97910d75..cbf8f567 100644 --- a/piikii-output-web/avocado/src/main/kotlin/com/piikii/output/web/avocado/adapter/AvocadoPlaceInfoResponse.kt +++ b/piikii-output-web/avocado/src/main/kotlin/com/piikii/output/web/avocado/adapter/AvocadoPlaceInfoResponse.kt @@ -10,7 +10,7 @@ import com.piikii.application.domain.place.OriginPlace @JsonIgnoreProperties(ignoreUnknown = true) data class AvocadoPlaceInfoResponse( - val id: Long, + val id: Long?, val name: String, val visitorReviewScore: Double?, val roadAddress: String?, @@ -21,7 +21,7 @@ data class AvocadoPlaceInfoResponse( val category: String?, val microReview: String?, val businessHours: String?, - val buttons: Buttons, + val buttons: Buttons?, @JsonProperty("x") val longitude: Double?, @JsonProperty("y") @@ -35,7 +35,7 @@ data class AvocadoPlaceInfoResponse( url = url, thumbnailLinks = ThumbnailLinks(images ?: emptyList()), address = roadAddress, - phoneNumber = buttons.phone, + phoneNumber = buttons?.phone, starGrade = visitorReviewScore, longitude = longitude, latitude = latitude, diff --git a/piikii-output-web/lemon/src/main/kotlin/com/piikii/output/web/lemon/adapter/LemonPlaceInfoResponse.kt b/piikii-output-web/lemon/src/main/kotlin/com/piikii/output/web/lemon/adapter/LemonPlaceInfoResponse.kt index 5395a362..1df4b344 100644 --- a/piikii-output-web/lemon/src/main/kotlin/com/piikii/output/web/lemon/adapter/LemonPlaceInfoResponse.kt +++ b/piikii-output-web/lemon/src/main/kotlin/com/piikii/output/web/lemon/adapter/LemonPlaceInfoResponse.kt @@ -20,7 +20,7 @@ data class LemonPlaceInfoResponse( fun toOriginPlace(url: String): OriginPlace { requireNotNull(basicInfo) { "BasicInfo is required" } val fullAddress = - "${basicInfo.address.region.fullname ?: ""} ${basicInfo.address.newaddr?.newaddrfull ?: ""}" + "${basicInfo.address?.region?.fullname ?: ""} ${basicInfo.address?.newaddr?.newaddrfull ?: ""}" .trim() return OriginPlace( id = LongTypeId(0L), @@ -30,28 +30,28 @@ data class LemonPlaceInfoResponse( thumbnailLinks = ThumbnailLinks(basicInfo.mainphotourl), address = fullAddress, phoneNumber = null, - starGrade = basicInfo.feedback.calculateStarGrade(), + starGrade = basicInfo.feedback?.calculateStarGrade(), longitude = basicInfo.wpointx?.toDouble(), latitude = basicInfo.wpointy?.toDouble(), - reviewCount = basicInfo.feedback.blogrvwcnt, - category = basicInfo.category.cate1name, - openingHours = basicInfo.openHour.toPrintFormat(), + reviewCount = basicInfo.feedback?.blogrvwcnt ?: 0, + category = basicInfo.category?.cate1name, + openingHours = basicInfo.openHour?.toPrintFormat(), origin = Origin.LEMON, ) } @JsonIgnoreProperties(ignoreUnknown = true) data class BasicInfo( - val cid: Long, + val cid: Long?, val placenamefull: String, - val mainphotourl: String, - val address: Address, + val mainphotourl: String?, + val address: Address?, val homepage: String?, val wpointx: Int?, val wpointy: Int?, - val category: Category, - val feedback: Feedback, - val openHour: OpenHour, + val category: Category?, + val feedback: Feedback?, + val openHour: OpenHour?, ) @JsonIgnoreProperties(ignoreUnknown = true) @@ -106,7 +106,7 @@ data class LemonPlaceInfoResponse( @JsonIgnoreProperties(ignoreUnknown = true) data class Period( - val periodName: String, + val periodName: String?, val timeList: List