From 019c4d28c8b7e49675755f9c8c632d5ba52ab2be Mon Sep 17 00:00:00 2001 From: Ray Jang Date: Sun, 4 Feb 2024 21:56:56 +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?= 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 - .../repository/heart/MockHeartRepository.kt | 31 ++++++------ .../sociallogin/KakaoLoginRepositoryImpl.kt | 1 - .../android/domain/model/heart/Heart.kt | 15 +++--- .../domain/model/heart/RelatedHeart.kt | 1 - .../domain/model/relation/RelationDetail.kt | 1 - .../domain/model/relation/RelationSimple.kt | 1 - .../model/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 91fbbb23..815f775a 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.heart.Heart -import ac.dnd.bookkeeping.android.domain.model.heart.HeartGroup +import ac.dnd.bookkeeping.android.domain.model.heart.HeartRelation +import ac.dnd.bookkeeping.android.domain.model.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/heart/MockHeartRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/MockHeartRepository.kt index 14ea6f35..bc7d1ce7 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/MockHeartRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/MockHeartRepository.kt @@ -1,7 +1,8 @@ package ac.dnd.bookkeeping.android.data.repository.heart import ac.dnd.bookkeeping.android.domain.model.heart.Heart -import ac.dnd.bookkeeping.android.domain.model.heart.HeartGroup +import ac.dnd.bookkeeping.android.domain.model.heart.HeartRelation +import ac.dnd.bookkeeping.android.domain.model.heart.HeartRelationGroup import ac.dnd.bookkeeping.android.domain.model.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/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/sociallogin/KakaoLoginRepositoryImpl.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/sociallogin/KakaoLoginRepositoryImpl.kt index 1fd1e66d..22220f88 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/sociallogin/KakaoLoginRepositoryImpl.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/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/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/Heart.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/Heart.kt index 4feecd2d..436a7e19 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/Heart.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/Heart.kt @@ -1,17 +1,18 @@ package ac.dnd.bookkeeping.android.domain.model.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/heart/RelatedHeart.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/RelatedHeart.kt index 7b70c5b9..303c10cb 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/RelatedHeart.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/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/relation/RelationDetail.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationDetail.kt index 0afc7770..fcb7fd52 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationDetail.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/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/relation/RelationSimple.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationSimple.kt index a15ce3e2..d489081f 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationSimple.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/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/schedule/UnrecordedSchedule.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/schedule/UnrecordedSchedule.kt index 766a9d88..4092df90 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/schedule/UnrecordedSchedule.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/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 a16e69a7..446ed5ad 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 -> { @@ -154,7 +153,6 @@ private fun NavHostController.sendKakaoUserModel(kakaoUserModel: KakaoUserInform navigate(LoginOnBoardingConstant.CONTAIN_USER_MODEL) } - @Composable private fun SampleComponent() { Box( @@ -182,7 +180,6 @@ private fun SampleComponent() { } } - @Preview @Composable fun LoginMainScreenPreview() {