From ba727ff45ec1884b63f82ffee450db69424836ad Mon Sep 17 00:00:00 2001 From: Ray Jang <48707913+ajou4095@users.noreply.github.com> Date: Mon, 5 Feb 2024 01:11:26 +0900 Subject: [PATCH] =?UTF-8?q?[Feature]=20=EB=A7=88=EC=9D=8C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=ED=95=98=EA=B8=B0=20Response=20Model=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/remote/network/api/FileApi.kt | 1 - .../network/model/authentication/LoginRes.kt | 1 - .../model/authentication/RegisterRes.kt | 1 - .../remote/network/model/heart/AddHeartRes.kt | 1 - .../model/heart/AddUnrecordedHeartRes.kt | 1 - .../network/model/heart/GetHeartListRes.kt | 49 ++++++++++--------- .../network/model/relation/AddRelationRes.kt | 1 - .../network/model/schedule/AddScheduleRes.kt | 1 - .../data/remote/network/util/NetworkUtil.kt | 1 - .../sociallogin/KakaoLoginRepositoryImpl.kt | 1 - .../feature/heart/MockHeartRepository.kt | 31 ++++++------ .../domain/model/feature/heart/Heart.kt | 15 +++--- .../model/feature/heart/RelatedHeart.kt | 1 - .../model/feature/relation/RelationDetail.kt | 1 - .../model/feature/relation/RelationSimple.kt | 1 - .../feature/schedule/UnrecordedSchedule.kt | 1 - .../view/chip/GroupChipListComponent.kt | 1 - .../common/view/textfield/TypingPriceField.kt | 1 - .../main/detail/HistoryDetailScreen.kt | 1 - .../ui/main/login/main/LoginMainScreen.kt | 3 -- 20 files changed, 51 insertions(+), 63 deletions(-) diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/FileApi.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/FileApi.kt index 66b66f3a..f1feea03 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/FileApi.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/FileApi.kt @@ -18,7 +18,6 @@ import io.ktor.http.HttpHeaders import java.io.File import javax.inject.Inject - class FileApi @Inject constructor( @NoAuthHttpClient private val noAuthClient: HttpClient, @AuthHttpClient private val client: HttpClient, diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/LoginRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/LoginRes.kt index 43b4de64..59db9f73 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/LoginRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/LoginRes.kt @@ -17,4 +17,3 @@ data class LoginRes( return isNew } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt index 41cbd0a5..5f88ba1a 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt @@ -17,4 +17,3 @@ data class RegisterRes( return id } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddHeartRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddHeartRes.kt index 4b43ca55..c6045c08 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddHeartRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddHeartRes.kt @@ -13,4 +13,3 @@ data class AddHeartRes( return result } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddUnrecordedHeartRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddUnrecordedHeartRes.kt index 88351f12..129f5de8 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddUnrecordedHeartRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/AddUnrecordedHeartRes.kt @@ -13,4 +13,3 @@ data class AddUnrecordedHeartRes( return result } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetHeartListRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetHeartListRes.kt index cef83f4c..5362ca47 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetHeartListRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetHeartListRes.kt @@ -2,7 +2,8 @@ package ac.dnd.bookkeeping.android.data.remote.network.model.heart import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper import ac.dnd.bookkeeping.android.domain.model.feature.heart.Heart -import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartGroup +import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartRelation +import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartRelationGroup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -16,19 +17,10 @@ data class GetHeartListRes( } } - @Serializable data class GetHeartItemRes( - @SerialName("id") - val id: Long, - @SerialName("relationId") - val relationId: Long, - @SerialName("give") - val give: Boolean, - @SerialName("name") - val name: String, - @SerialName("group") - val group: GetHeartItemGroupRes, + @SerialName("relation") + val relation: GetHeartItemRelationRes, @SerialName("giveHistories") val giveHistories: List, @SerialName("takeHistories") @@ -36,11 +28,7 @@ data class GetHeartItemRes( ) : DataMapper { override fun toDomain(): Heart { return Heart( - id = id, - relationId = relationId, - give = give, - name = name, - group = group.toDomain(), + relation = relation.toDomain(), giveHistories = giveHistories, takeHistories = takeHistories ) @@ -48,17 +36,34 @@ data class GetHeartItemRes( } @Serializable -data class GetHeartItemGroupRes( +data class GetHeartItemRelationRes( + @SerialName("id") + val id: Long, + @SerialName("name") + val name: String, + @SerialName("group") + val group: GetHeartItemRelationGroupRes +) : DataMapper { + override fun toDomain(): HeartRelation { + return HeartRelation( + id = id, + name = name, + group = group.toDomain() + ) + } +} + +@Serializable +data class GetHeartItemRelationGroupRes( @SerialName("id") val id: Long, @SerialName("name") val name: String -) : DataMapper { - override fun toDomain(): HeartGroup { - return HeartGroup( +) : DataMapper { + override fun toDomain(): HeartRelationGroup { + return HeartRelationGroup( id = id, name = name ) } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/AddRelationRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/AddRelationRes.kt index 837cbddb..ec1ce877 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/AddRelationRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/AddRelationRes.kt @@ -13,4 +13,3 @@ data class AddRelationRes( return result } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/AddScheduleRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/AddScheduleRes.kt index ea5b664a..a49161ff 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/AddScheduleRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/AddScheduleRes.kt @@ -13,4 +13,3 @@ data class AddScheduleRes( return result } } - diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/util/NetworkUtil.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/util/NetworkUtil.kt index 17eea07e..d7aeb24d 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/util/NetworkUtil.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/util/NetworkUtil.kt @@ -18,7 +18,6 @@ val HttpResponse.isSuccessful: Boolean val HttpResponse.isBadRequest: Boolean get() = status.value in 400..499 - val HttpResponse.isInternalServerError: Boolean get() = status.value in 500..599 diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/sociallogin/KakaoLoginRepositoryImpl.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/sociallogin/KakaoLoginRepositoryImpl.kt index 055c52aa..da498518 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/sociallogin/KakaoLoginRepositoryImpl.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/sociallogin/KakaoLoginRepositoryImpl.kt @@ -73,7 +73,6 @@ class KakaoLoginRepositoryImpl @Inject constructor( } } - override suspend fun logout(): Result = runCatching { suspendCoroutine { continuation -> UserApiClient.instance.logout { error -> diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/feature/heart/MockHeartRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/feature/heart/MockHeartRepository.kt index 22cf2905..f4fea5e4 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/feature/heart/MockHeartRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/feature/heart/MockHeartRepository.kt @@ -1,7 +1,8 @@ package ac.dnd.bookkeeping.android.data.repository.feature.heart import ac.dnd.bookkeeping.android.domain.model.feature.heart.Heart -import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartGroup +import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartRelation +import ac.dnd.bookkeeping.android.domain.model.feature.heart.HeartRelationGroup import ac.dnd.bookkeeping.android.domain.model.feature.heart.RelatedHeart import ac.dnd.bookkeeping.android.domain.repository.HeartRepository import kotlinx.coroutines.delay @@ -59,13 +60,13 @@ class MockHeartRepository @Inject constructor() : HeartRepository { return Result.success( listOf( Heart( - id = 2059, - relationId = 4920, - give = false, - name = "Lorie Adams", - group = HeartGroup( - id = 7435, - name = "Octavio Hayes" + relation = HeartRelation( + id = 2059, + name = "Lorie Adams", + group = HeartRelationGroup( + id = 7435, + name = "Octavio Hayes" + ) ), giveHistories = listOf( 1_000L, @@ -85,13 +86,13 @@ class MockHeartRepository @Inject constructor() : HeartRepository { ) ), Heart( - id = 6007, - relationId = 5328, - give = true, - name = "Jody Huffman", - group = HeartGroup( - id = 1855, - name = "Randi Sweet" + relation = HeartRelation( + id = 6007, + name = "Jody Huffman", + group = HeartRelationGroup( + id = 1855, + name = "Randi Sweet" + ), ), giveHistories = listOf( 1_000L, diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/Heart.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/Heart.kt index 82977f1e..c7a0aca1 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/Heart.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/Heart.kt @@ -1,17 +1,18 @@ package ac.dnd.bookkeeping.android.domain.model.feature.heart data class Heart( - val id: Long, - val relationId: Long, - val give: Boolean, - val name: String, - val group: HeartGroup, + val relation: HeartRelation, val giveHistories: List, val takeHistories: List ) -data class HeartGroup( +data class HeartRelation( val id: Long, - val name: String + val name: String, + val group: HeartRelationGroup ) +data class HeartRelationGroup( + val id: Long, + val name: String +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/RelatedHeart.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/RelatedHeart.kt index 98ded71d..8e30bcf5 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/RelatedHeart.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/heart/RelatedHeart.kt @@ -11,4 +11,3 @@ data class RelatedHeart( val memo: String, val tags: List ) - diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationDetail.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationDetail.kt index 42b43e76..40cd1cfe 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationDetail.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationDetail.kt @@ -12,4 +12,3 @@ data class RelationDetailGroup( val id: Long, val name: String ) - diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationSimple.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationSimple.kt index 70c52099..aac80fa2 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationSimple.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/relation/RelationSimple.kt @@ -10,4 +10,3 @@ data class RelationSimpleGroup( val id: Long, val name: String ) - diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/schedule/UnrecordedSchedule.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/schedule/UnrecordedSchedule.kt index e74d6252..5183918e 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/schedule/UnrecordedSchedule.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/feature/schedule/UnrecordedSchedule.kt @@ -19,4 +19,3 @@ data class UnrecordedScheduleRelation( val id: Long, val name: String ) - diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/chip/GroupChipListComponent.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/chip/GroupChipListComponent.kt index f4990dc7..bf651358 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/chip/GroupChipListComponent.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/chip/GroupChipListComponent.kt @@ -10,7 +10,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp - @Composable fun GroupChipListComponent( chipType: ChipType = ChipType.LESS_BORDER, diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt index ab98ea26..1d5123b0 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/view/textfield/TypingPriceField.kt @@ -207,7 +207,6 @@ fun EnterMoneyField2Preivew() { ) } - @Composable @Preview(backgroundColor = 0xFFFFFFFF, showBackground = true) fun EnterMoneyField3Preview() { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailScreen.kt index 35d9e2e0..c6d25b76 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailScreen.kt @@ -395,7 +395,6 @@ fun EmptyRelationView() { } } - @Preview(showBackground = true) @Composable fun HistoryDetailPreview() { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/login/main/LoginMainScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/login/main/LoginMainScreen.kt index b9b499a5..7000abe5 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/login/main/LoginMainScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/login/main/LoginMainScreen.kt @@ -67,7 +67,6 @@ fun LoginMainScreen( } } - fun login(event: LoginMainEvent.Login) { when (event) { is LoginMainEvent.Login.Success -> { @@ -155,7 +154,6 @@ private fun NavHostController.sendKakaoUserModel(kakaoUserModel: KakaoUserInform navigate(LoginOnBoardingConstant.CONTAIN_USER_MODEL) } - @Composable private fun SampleComponent() { Box( @@ -183,7 +181,6 @@ private fun SampleComponent() { } } - @Preview @Composable fun LoginMainScreenPreview() {