Skip to content

Commit

Permalink
hotfix: Lemon/Avocado Response Format to Nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Sep 5, 2024
1 parent fd2920f commit b9b8673
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand All @@ -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")
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down Expand Up @@ -106,7 +106,7 @@ data class LemonPlaceInfoResponse(

@JsonIgnoreProperties(ignoreUnknown = true)
data class Period(
val periodName: String,
val periodName: String?,
val timeList: List<Time>?,
) {
fun toPrintFormat(): String? =
Expand All @@ -132,10 +132,10 @@ data class LemonPlaceInfoResponse(

@JsonIgnoreProperties(ignoreUnknown = true)
data class CommentItem(
val contents: String,
val point: Int,
val username: String,
val date: String,
val contents: String?,
val point: Int?,
val username: String?,
val date: String?,
)

@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -163,7 +163,7 @@ data class LemonPlaceInfoResponse(

@JsonIgnoreProperties(ignoreUnknown = true)
data class PhotoItem(
val photoid: String,
val orgurl: String,
val photoid: String?,
val orgurl: String?,
)
}

0 comments on commit b9b8673

Please sign in to comment.