Skip to content

Commit

Permalink
[Feature] 마음 조회하기 Response Model 변경 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajou4095 authored Feb 4, 2024
1 parent 2a3acf0 commit ba727ff
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ data class LoginRes(
return isNew
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ data class RegisterRes(
return id
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ data class AddHeartRes(
return result
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ data class AddUnrecordedHeartRes(
return result
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -16,49 +17,53 @@ 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<Long>,
@SerialName("takeHistories")
val takeHistories: List<Long>
) : DataMapper<Heart> {
override fun toDomain(): Heart {
return Heart(
id = id,
relationId = relationId,
give = give,
name = name,
group = group.toDomain(),
relation = relation.toDomain(),
giveHistories = giveHistories,
takeHistories = takeHistories
)
}
}

@Serializable
data class GetHeartItemGroupRes(
data class GetHeartItemRelationRes(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String,
@SerialName("group")
val group: GetHeartItemRelationGroupRes
) : DataMapper<HeartRelation> {
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<HeartGroup> {
override fun toDomain(): HeartGroup {
return HeartGroup(
) : DataMapper<HeartRelationGroup> {
override fun toDomain(): HeartRelationGroup {
return HeartRelationGroup(
id = id,
name = name
)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ data class AddRelationRes(
return result
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ data class AddScheduleRes(
return result
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class KakaoLoginRepositoryImpl @Inject constructor(
}
}


override suspend fun logout(): Result<Boolean> = runCatching {
suspendCoroutine { continuation ->
UserApiClient.instance.logout { error ->
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Long>,
val takeHistories: List<Long>
)

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
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ data class RelatedHeart(
val memo: String,
val tags: List<String>
)

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ data class RelationDetailGroup(
val id: Long,
val name: String
)

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ data class RelationSimpleGroup(
val id: Long,
val name: String
)

Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ data class UnrecordedScheduleRelation(
val id: Long,
val name: String
)

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ fun EnterMoneyField2Preivew() {
)
}


@Composable
@Preview(backgroundColor = 0xFFFFFFFF, showBackground = true)
fun EnterMoneyField3Preview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ fun EmptyRelationView() {
}
}


@Preview(showBackground = true)
@Composable
fun HistoryDetailPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ fun LoginMainScreen(
}
}


fun login(event: LoginMainEvent.Login) {
when (event) {
is LoginMainEvent.Login.Success -> {
Expand Down Expand Up @@ -155,7 +154,6 @@ private fun NavHostController.sendKakaoUserModel(kakaoUserModel: KakaoUserInform
navigate(LoginOnBoardingConstant.CONTAIN_USER_MODEL)
}


@Composable
private fun SampleComponent() {
Box(
Expand Down Expand Up @@ -183,7 +181,6 @@ private fun SampleComponent() {
}
}


@Preview
@Composable
fun LoginMainScreenPreview() {
Expand Down

0 comments on commit ba727ff

Please sign in to comment.