Skip to content

Commit

Permalink
[Feature] Repository 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
ajou4095 committed Feb 3, 2024
1 parent bc29c7b commit 3c97ca8
Show file tree
Hide file tree
Showing 39 changed files with 1,058 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import ac.dnd.bookkeeping.android.data.remote.network.environment.ErrorMessageMa
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.GetAccessTokenRes
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.LoginReq
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.LoginRes
import ac.dnd.bookkeeping.android.data.remote.network.model.error.RegisterReq
import ac.dnd.bookkeeping.android.data.remote.network.model.error.RegisterRes
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.RegisterReq
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.RegisterRes
import ac.dnd.bookkeeping.android.data.remote.network.util.convert
import io.ktor.client.HttpClient
import io.ktor.client.request.delete
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.authentication

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -11,4 +12,9 @@ data class LoginRes(
val accessToken: String,
@SerialName("refreshToken")
val refreshToken: String
)
) : DataMapper<Boolean> {
override fun toDomain(): Boolean {
return isNew
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.error
package ac.dnd.bookkeeping.android.data.remote.network.model.authentication

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.error
package ac.dnd.bookkeeping.android.data.remote.network.model.authentication

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -11,4 +12,9 @@ data class RegisterRes(
val accessToken: String,
@SerialName("refreshToken")
val refreshToken: String
)
) : DataMapper<Long> {
override fun toDomain(): Long {
return id
}
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.group

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AddGroupRes(
@SerialName("result")
val result: Long
)
) : DataMapper<Long> {
override fun toDomain(): Long {
return result
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.group

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import ac.dnd.bookkeeping.android.domain.model.group.Group
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class GetGroupListRes(
@SerialName("result")
val result: List<GetGroupItemRes>
)
) : DataMapper<List<Group>> {
override fun toDomain(): List<Group> {
return result.map { it.toDomain() }
}
}

@Serializable
data class GetGroupItemRes(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String
)
) : DataMapper<Group> {
override fun toDomain(): Group {
return Group(
id = id,
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.heart

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AddHeartRes(
@SerialName("result")
val result: Long
)
) : DataMapper<Long> {
override fun toDomain(): Long {
return result
}
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.heart

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AddUnrecordedHeartRes(
@SerialName("result")
val result: Long
)
) : DataMapper<Long> {
override fun toDomain(): Long {
return result
}
}

Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
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 kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class GetHeartListRes(
@SerialName("result")
val result: List<GetHeartItemRes>
)
) : DataMapper<List<Heart>> {
override fun toDomain(): List<Heart> {
return result.map { it.toDomain() }
}
}


@Serializable
data class GetHeartItemRes(
Expand All @@ -25,13 +33,32 @@ data class GetHeartItemRes(
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(),
giveHistories = giveHistories,
takeHistories = takeHistories
)
}
}

@Serializable
data class GetHeartItemGroupRes(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String
)
) : DataMapper<HeartGroup> {
override fun toDomain(): HeartGroup {
return HeartGroup(
id = id,
name = name
)
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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.RelatedHeart
import kotlinx.datetime.LocalDate
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -8,7 +10,11 @@ import kotlinx.serialization.Serializable
data class GetRelatedHeartListRes(
@SerialName("result")
val result: List<GetRelatedHeartItemRes>
)
) : DataMapper<List<RelatedHeart>> {
override fun toDomain(): List<RelatedHeart> {
return result.map { it.toDomain() }
}
}

@Serializable
data class GetRelatedHeartItemRes(
Expand All @@ -26,5 +32,16 @@ data class GetRelatedHeartItemRes(
val memo: String,
@SerialName("tags")
val tags: List<String>
)

) : DataMapper<RelatedHeart> {
override fun toDomain(): RelatedHeart {
return RelatedHeart(
id = id,
give = give,
money = money,
day = day,
event = event,
memo = memo,
tags = tags
)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.member

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class CheckNicknameRes(
@SerialName("result")
val result: Boolean
)
) : DataMapper<Boolean> {
override fun toDomain(): Boolean {
return result
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.member

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import ac.dnd.bookkeeping.android.domain.model.member.Profile
import kotlinx.datetime.LocalDate
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -14,4 +16,13 @@ data class GetProfileRes(
val gender: String,
@SerialName("birth")
val birth: LocalDate
)
) : DataMapper<Profile> {
override fun toDomain(): Profile {
return Profile(
name = name,
nickname = nickname,
gender = gender,
birth = birth
)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.relation

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class AddRelationRes(
@SerialName("result")
val result: Long
)
) : DataMapper<Long> {
override fun toDomain(): Long {
return result
}
}

Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.relation

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimple
import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimpleGroup
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class GetRelationListRes(
@SerialName("result")
val result: List<GetRelationItemRes>
)
) : DataMapper<List<RelationSimple>> {
override fun toDomain(): List<RelationSimple> {
return result.map { it.toDomain() }
}
}

@Serializable
data class GetRelationItemRes(
Expand All @@ -17,13 +24,27 @@ data class GetRelationItemRes(
val name: String,
@SerialName("group")
val group: GetRelationItemGroupRes,
)
) : DataMapper<RelationSimple> {
override fun toDomain(): RelationSimple {
return RelationSimple(
id = id,
name = name,
group = group.toDomain()
)
}
}

@Serializable
data class GetRelationItemGroupRes(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String
)

) : DataMapper<RelationSimpleGroup> {
override fun toDomain(): RelationSimpleGroup {
return RelationSimpleGroup(
id = id,
name = name
)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package ac.dnd.bookkeeping.android.data.remote.network.model.relation

import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper
import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetail
import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetailGroup
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -15,13 +18,29 @@ data class GetRelationRes(
val giveMoney: Long,
@SerialName("takeMoney")
val takeMoney: Long
)
) : DataMapper<RelationDetail> {
override fun toDomain(): RelationDetail {
return RelationDetail(
id = id,
name = name,
group = group.toDomain(),
giveMoney = giveMoney,
takeMoney = takeMoney
)
}
}

@Serializable
data class GetRelationGroupRes(
@SerialName("id")
val id: Long,
@SerialName("name")
val name: String
)

) : DataMapper<RelationDetailGroup> {
override fun toDomain(): RelationDetailGroup {
return RelationDetailGroup(
id = id,
name = name
)
}
}
Loading

0 comments on commit 3c97ca8

Please sign in to comment.