Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update dining response #211

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package `in`.koreatech.koin.data.mapper

import `in`.koreatech.koin.data.response.DiningResponse
import `in`.koreatech.koin.domain.model.dining.Dining
import `in`.koreatech.koin.domain.model.dining.DiningType

fun DiningResponse.toDining() = Dining(
this.id,
Expand All @@ -13,8 +12,13 @@ fun DiningResponse.toDining() = Dining(
(this.priceCash ?: 0).toString(),
(this.kcal ?: 0).toString(),
this.menu,
this.imageUrl ?: "",
this.createdAt,
this.updatedAt,
this.isSoldOut,
// TODO: sold_out 품절 시각으로 변경시 대응
// this.soldOutAt ?: ""
this.isChanged,
this.error ?: ""
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ data class DiningResponse(
@SerializedName("price_cash") val priceCash: Int?,
@SerializedName("kcal") val kcal: Int?,
@SerializedName("menu") val menu: List<String>,
@SerializedName("image_url") val imageUrl: String?,
@SerializedName("created_at") val createdAt: String,
@SerializedName("updated_at") val updatedAt: String,
@SerializedName("sold_out") val isSoldOut: Boolean,
Comment on lines 16 to +17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sold_out 부분만 SerializedName하고 변수명이 다른데 이유가 있는 건가요?

Copy link
Contributor Author

@wateralsie wateralsie Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변수명 앞에 is 를 붙이면 boolean인지 바로 알 수 있어서 개인적인 컨벤션으로 쓰게 되더라고요! 바로 아래쪽에 isChanged 도 있어서 일관성 맞춰주기 위해 쓴 것도 있습니다
@junghaesung79

// TODO: sold_out 품절 시각으로 변경시 대응
// @SerializedName("sold_out") val soldOutAt: String?,
@SerializedName("is_changed") val isChanged: Boolean,
@SerializedName("error") val error: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ data class Dining(
val priceCash: String,
val kcal: String,
val menu: List<String>,
val imageUrl: String,
val createdAt: String,
val updatedAt: String,
val isSoldOut: Boolean,
// TODO: sold_out 품절 시각으로 변경시 대응
// val soldOutAt: String,
val isChanged: Boolean,
val error: String
)
Loading