Skip to content

Commit

Permalink
#68 feat : UiRestaurantData formatted 진행
Browse files Browse the repository at this point in the history
리뷰갯수, 전화번호
  • Loading branch information
BENDENG1 committed Dec 4, 2023
1 parent 12593fc commit 18cb227
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ package com.avengers.nibobnebob.presentation.ui.main.home.mapper
import com.avengers.nibobnebob.data.model.response.RestaurantResponse
import com.avengers.nibobnebob.presentation.ui.main.home.model.UiRestaurantData

fun RestaurantResponse.toUiRestaurantData(): UiRestaurantData = UiRestaurantData(
id = id,
latitude = location.coordinates[1], //응답 형식이 "경도 위도"임..
longitude = location.coordinates[0],
name = name,
address = address,
phoneNumber = phoneNumber,
reviewCount = "${reviewCnt}",
isInWishList = isWish,
isInMyList = isMy
)
fun RestaurantResponse.toUiRestaurantData(): UiRestaurantData {
val formattedPhoneNumber = phoneNumber.ifEmpty { "전화번호 없음" }
val formattedReviewCnt = "$reviewCnt"

return UiRestaurantData(
id = id,
latitude = location.coordinates[1], //응답 형식이 "경도 위도"임..
longitude = location.coordinates[0],
name = name,
address = address,
phoneNumber = formattedPhoneNumber,
reviewCount = formattedReviewCnt,
isInWishList = isWish,
isInMyList = isMy
)
}

0 comments on commit 18cb227

Please sign in to comment.