Skip to content

Commit

Permalink
fix: 마지막 댓글 response를 nullable하게 수정 (#115)
Browse files Browse the repository at this point in the history
* fix: 마지막 댓글 response를 nullable하게 수정

* refactor: ktFormat 적용
  • Loading branch information
songpink authored Jul 25, 2024
1 parent 7066818 commit 2e35368
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ fun CommentRoomResponse.toDomain(): CommentRoom {
return CommentRoom(
id = this.offeringId,
title = this.offeringTitle,
latestComment = this.latestComment.content,
latestCommentTime = this.latestComment.createdAt.toLocalDateTime(),
latestComment = this.latestComment.content ?: "",
latestCommentTime = this.latestComment.createdAt?.toLocalDateTime(),
isProposer = this.isProposer,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import kotlinx.serialization.Serializable

@Serializable
data class LatestCommentResponse(
@SerialName("content") val content: String,
@SerialName("createdAt") val createdAt: String,
@SerialName("content") val content: String?,
@SerialName("createdAt") val createdAt: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ data class CommentRoom(
val id: Long,
val title: String,
val latestComment: String,
val latestCommentTime: LocalDateTime,
val latestCommentTime: LocalDateTime?,
val isProposer: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ fun setLayoutHeightWithAnimation(
}

@BindingAdapter("formattedAmPmTime")
fun TextView.setTime(localDateTime: LocalDateTime) {
this.text = localDateTime.format(DateTimeFormatter.ofPattern(context.getString(R.string.amPmTime), Locale.KOREAN))
fun TextView.setTime(localDateTime: LocalDateTime?) {
this.text = localDateTime?.format(DateTimeFormatter.ofPattern(context.getString(R.string.amPmTime), Locale.KOREAN)) ?: ""
}

private fun Int.toPx(context: Context): Int {
Expand Down

0 comments on commit 2e35368

Please sign in to comment.