From 06bced87d67ccd9146d2270325b67be9df571f75 Mon Sep 17 00:00:00 2001 From: songpink Date: Thu, 25 Jul 2024 23:38:03 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=A7=88=EC=A7=80=EB=A7=89=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20response=EB=A5=BC=20nullable=ED=95=98?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt | 5 +++-- .../data/remote/dto/response/LatestCommentResponse.kt | 4 ++-- .../main/java/com/zzang/chongdae/domain/model/CommentRoom.kt | 2 +- .../com/zzang/chongdae/presentation/util/BindingAdapters.kt | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt b/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt index afe715c1b..296b407e2 100644 --- a/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt +++ b/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt @@ -2,13 +2,14 @@ package com.zzang.chongdae.data.mapper import com.zzang.chongdae.data.remote.dto.response.CommentRoomResponse import com.zzang.chongdae.domain.model.CommentRoom +import java.time.LocalDateTime 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, ) } diff --git a/android/app/src/main/java/com/zzang/chongdae/data/remote/dto/response/LatestCommentResponse.kt b/android/app/src/main/java/com/zzang/chongdae/data/remote/dto/response/LatestCommentResponse.kt index 462d13b07..cf1fc6c24 100644 --- a/android/app/src/main/java/com/zzang/chongdae/data/remote/dto/response/LatestCommentResponse.kt +++ b/android/app/src/main/java/com/zzang/chongdae/data/remote/dto/response/LatestCommentResponse.kt @@ -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?, ) diff --git a/android/app/src/main/java/com/zzang/chongdae/domain/model/CommentRoom.kt b/android/app/src/main/java/com/zzang/chongdae/domain/model/CommentRoom.kt index cd7a855ca..c9983ce21 100644 --- a/android/app/src/main/java/com/zzang/chongdae/domain/model/CommentRoom.kt +++ b/android/app/src/main/java/com/zzang/chongdae/domain/model/CommentRoom.kt @@ -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, ) diff --git a/android/app/src/main/java/com/zzang/chongdae/presentation/util/BindingAdapters.kt b/android/app/src/main/java/com/zzang/chongdae/presentation/util/BindingAdapters.kt index a6eead60f..f880a3ac6 100644 --- a/android/app/src/main/java/com/zzang/chongdae/presentation/util/BindingAdapters.kt +++ b/android/app/src/main/java/com/zzang/chongdae/presentation/util/BindingAdapters.kt @@ -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 { From 47e9501517220e0a27a6f0fa4f0cd5b803b2144e Mon Sep 17 00:00:00 2001 From: songpink Date: Thu, 25 Jul 2024 23:44:40 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20ktFormat=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt b/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt index 296b407e2..ff0f5584e 100644 --- a/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt +++ b/android/app/src/main/java/com/zzang/chongdae/data/mapper/CommentRoomResponseMapper.kt @@ -2,7 +2,6 @@ package com.zzang.chongdae.data.mapper import com.zzang.chongdae.data.remote.dto.response.CommentRoomResponse import com.zzang.chongdae.domain.model.CommentRoom -import java.time.LocalDateTime fun CommentRoomResponse.toDomain(): CommentRoom { return CommentRoom(