diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/di/RepositoryModule.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/di/RepositoryModule.kt index 2bde022e..075f8d6d 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/di/RepositoryModule.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/di/RepositoryModule.kt @@ -2,12 +2,22 @@ package ac.dnd.bookkeeping.android.data.di import ac.dnd.bookkeeping.android.data.repository.authentication.MockAuthenticationRepository import ac.dnd.bookkeeping.android.data.repository.file.MockFileRepository +import ac.dnd.bookkeeping.android.data.repository.group.MockGroupRepository +import ac.dnd.bookkeeping.android.data.repository.heart.MockHeartRepository import ac.dnd.bookkeeping.android.data.repository.member.MockMemberRepository +import ac.dnd.bookkeeping.android.data.repository.relation.MockRelationRepository +import ac.dnd.bookkeeping.android.data.repository.schedule.MockScheduleRepository import ac.dnd.bookkeeping.android.data.repository.sociallogin.KakaoLoginRepositoryImpl +import ac.dnd.bookkeeping.android.data.repository.statistics.MockStatisticsRepository import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository import ac.dnd.bookkeeping.android.domain.repository.FileRepository +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository import ac.dnd.bookkeeping.android.domain.repository.KakaoLoginRepository import ac.dnd.bookkeeping.android.domain.repository.MemberRepository +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import ac.dnd.bookkeeping.android.domain.repository.StatisticsRepository import dagger.Binds import dagger.Module import dagger.hilt.InstallIn @@ -24,6 +34,18 @@ internal abstract class RepositoryModule { authenticationRepository: MockAuthenticationRepository ): AuthenticationRepository + @Binds + @Singleton + abstract fun bindsGroupRepository( + groupRepository: MockGroupRepository + ): GroupRepository + + @Binds + @Singleton + abstract fun bindsHeartRepository( + heartRepository: MockHeartRepository + ): HeartRepository + @Binds @Singleton abstract fun bindsMemberRepository( @@ -32,13 +54,31 @@ internal abstract class RepositoryModule { @Binds @Singleton - abstract fun bindsFileRepository( - fileRepository: MockFileRepository - ): FileRepository + abstract fun bindsRelationRepository( + relationRepository: MockRelationRepository + ): RelationRepository + + @Binds + @Singleton + abstract fun bindsScheduleRepository( + scheduleRepository: MockScheduleRepository + ): ScheduleRepository + + @Binds + @Singleton + abstract fun bindsStatisticsRepository( + statisticsRepository: MockStatisticsRepository + ): StatisticsRepository @Binds @Singleton abstract fun bindsKakaoLoginRepository( kakaoLoginRepositoryImpl: KakaoLoginRepositoryImpl ): KakaoLoginRepository + + @Binds + @Singleton + abstract fun bindsFileRepository( + fileRepository: MockFileRepository + ): FileRepository } diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/AuthenticationApi.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/AuthenticationApi.kt index 9a29dccf..2dcdb6a0 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/AuthenticationApi.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/api/AuthenticationApi.kt @@ -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 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 35338d21..43b4de64 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 @@ -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 @@ -11,4 +12,9 @@ data class LoginRes( val accessToken: String, @SerialName("refreshToken") val refreshToken: String -) +) : DataMapper { + override fun toDomain(): Boolean { + return isNew + } +} + diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterReq.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterReq.kt similarity index 86% rename from data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterReq.kt rename to data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterReq.kt index 9a29cdd7..2ffac7b7 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterReq.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterReq.kt @@ -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 diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt similarity index 55% rename from data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterRes.kt rename to data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt index 5960a62d..41cbd0a5 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/error/RegisterRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/RegisterRes.kt @@ -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 @@ -11,4 +12,9 @@ data class RegisterRes( val accessToken: String, @SerialName("refreshToken") val refreshToken: String -) +) : DataMapper { + override fun toDomain(): Long { + return id + } +} + diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/AddGroupRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/AddGroupRes.kt index 113267dd..b0485931 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/AddGroupRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/AddGroupRes.kt @@ -1,5 +1,6 @@ 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 @@ -7,4 +8,8 @@ import kotlinx.serialization.Serializable data class AddGroupRes( @SerialName("result") val result: Long -) +) : DataMapper { + override fun toDomain(): Long { + return result + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/GetGroupListRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/GetGroupListRes.kt index 1401881f..34f30e08 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/GetGroupListRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/group/GetGroupListRes.kt @@ -1,5 +1,7 @@ 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 @@ -7,7 +9,11 @@ import kotlinx.serialization.Serializable data class GetGroupListRes( @SerialName("result") val result: List -) +) : DataMapper> { + override fun toDomain(): List { + return result.map { it.toDomain() } + } +} @Serializable data class GetGroupItemRes( @@ -15,4 +21,11 @@ data class GetGroupItemRes( val id: Long, @SerialName("name") val name: String -) +) : DataMapper { + override fun toDomain(): Group { + return Group( + id = id, + name = name + ) + } +} 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 54ca9488..4b43ca55 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 @@ -1,5 +1,6 @@ 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 @@ -7,4 +8,9 @@ import kotlinx.serialization.Serializable data class AddHeartRes( @SerialName("result") val result: Long -) +) : DataMapper { + override fun toDomain(): Long { + 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 8b045eb3..88351f12 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 @@ -1,5 +1,6 @@ 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 @@ -7,4 +8,9 @@ import kotlinx.serialization.Serializable data class AddUnrecordedHeartRes( @SerialName("result") val result: Long -) +) : DataMapper { + override fun toDomain(): Long { + 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 bb04b3ac..91fbbb23 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 @@ -1,5 +1,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 kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -7,7 +10,12 @@ import kotlinx.serialization.Serializable data class GetHeartListRes( @SerialName("result") val result: List -) +) : DataMapper> { + override fun toDomain(): List { + return result.map { it.toDomain() } + } +} + @Serializable data class GetHeartItemRes( @@ -25,7 +33,19 @@ data class GetHeartItemRes( val giveHistories: List, @SerialName("takeHistories") val takeHistories: List -) +) : DataMapper { + 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( @@ -33,5 +53,12 @@ data class GetHeartItemGroupRes( val id: Long, @SerialName("name") val name: String -) +) : DataMapper { + override fun toDomain(): HeartGroup { + return HeartGroup( + id = id, + name = name + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetRelatedHeartListRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetRelatedHeartListRes.kt index 3ede8d60..005a3e21 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetRelatedHeartListRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/heart/GetRelatedHeartListRes.kt @@ -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 @@ -8,7 +10,11 @@ import kotlinx.serialization.Serializable data class GetRelatedHeartListRes( @SerialName("result") val result: List -) +) : DataMapper> { + override fun toDomain(): List { + return result.map { it.toDomain() } + } +} @Serializable data class GetRelatedHeartItemRes( @@ -26,5 +32,16 @@ data class GetRelatedHeartItemRes( val memo: String, @SerialName("tags") val tags: List -) - +) : DataMapper { + override fun toDomain(): RelatedHeart { + return RelatedHeart( + id = id, + give = give, + money = money, + day = day, + event = event, + memo = memo, + tags = tags + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/CheckNicknameRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/CheckNicknameRes.kt index 1d0bc95f..65a514b5 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/CheckNicknameRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/CheckNicknameRes.kt @@ -1,5 +1,6 @@ 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 @@ -7,4 +8,8 @@ import kotlinx.serialization.Serializable data class CheckNicknameRes( @SerialName("result") val result: Boolean -) +) : DataMapper { + override fun toDomain(): Boolean { + return result + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/GetProfileRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/GetProfileRes.kt index 62a0811e..956da0ad 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/GetProfileRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/member/GetProfileRes.kt @@ -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 @@ -14,4 +16,13 @@ data class GetProfileRes( val gender: String, @SerialName("birth") val birth: LocalDate -) +) : DataMapper { + override fun toDomain(): Profile { + return Profile( + name = name, + nickname = nickname, + gender = gender, + birth = birth + ) + } +} 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 eb9819fa..837cbddb 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 @@ -1,5 +1,6 @@ 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 @@ -7,4 +8,9 @@ import kotlinx.serialization.Serializable data class AddRelationRes( @SerialName("result") val result: Long -) +) : DataMapper { + override fun toDomain(): Long { + return result + } +} + diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationListRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationListRes.kt index 4c1480f2..7f834279 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationListRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationListRes.kt @@ -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.RelationSimple +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimpleGroup import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -7,7 +10,11 @@ import kotlinx.serialization.Serializable data class GetRelationListRes( @SerialName("result") val result: List -) +) : DataMapper> { + override fun toDomain(): List { + return result.map { it.toDomain() } + } +} @Serializable data class GetRelationItemRes( @@ -17,7 +24,15 @@ data class GetRelationItemRes( val name: String, @SerialName("group") val group: GetRelationItemGroupRes, -) +) : DataMapper { + override fun toDomain(): RelationSimple { + return RelationSimple( + id = id, + name = name, + group = group.toDomain() + ) + } +} @Serializable data class GetRelationItemGroupRes( @@ -25,5 +40,11 @@ data class GetRelationItemGroupRes( val id: Long, @SerialName("name") val name: String -) - +) : DataMapper { + override fun toDomain(): RelationSimpleGroup { + return RelationSimpleGroup( + id = id, + name = name + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationRes.kt index fe49bfe9..4a6f1077 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/relation/GetRelationRes.kt @@ -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 @@ -15,7 +18,17 @@ data class GetRelationRes( val giveMoney: Long, @SerialName("takeMoney") val takeMoney: Long -) +) : DataMapper { + override fun toDomain(): RelationDetail { + return RelationDetail( + id = id, + name = name, + group = group.toDomain(), + giveMoney = giveMoney, + takeMoney = takeMoney + ) + } +} @Serializable data class GetRelationGroupRes( @@ -23,5 +36,11 @@ data class GetRelationGroupRes( val id: Long, @SerialName("name") val name: String -) - +) : DataMapper { + override fun toDomain(): RelationDetailGroup { + return RelationDetailGroup( + id = id, + name = name + ) + } +} 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 d399f070..ea5b664a 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 @@ -1,5 +1,6 @@ package ac.dnd.bookkeeping.android.data.remote.network.model.schedule +import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -7,4 +8,9 @@ import kotlinx.serialization.Serializable data class AddScheduleRes( @SerialName("result") val result: Long -) +) : DataMapper { + override fun toDomain(): Long { + return result + } +} + diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/GetUnrecordedScheduleListRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/GetUnrecordedScheduleListRes.kt index 122d116d..8450bf15 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/GetUnrecordedScheduleListRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/schedule/GetUnrecordedScheduleListRes.kt @@ -1,5 +1,8 @@ package ac.dnd.bookkeeping.android.data.remote.network.model.schedule +import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedSchedule +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedScheduleRelation import kotlinx.datetime.LocalDate import kotlinx.datetime.LocalDateTime import kotlinx.datetime.LocalTime @@ -10,7 +13,11 @@ import kotlinx.serialization.Serializable data class GetUnrecordedScheduleListRes( @SerialName("result") val result: List -) +) : DataMapper> { + override fun toDomain(): List { + return result.map { it.toDomain() } + } +} @Serializable data class GetUnrecordedScheduleItemRes( @@ -30,7 +37,20 @@ data class GetUnrecordedScheduleItemRes( val link: String, @SerialName("location") val location: String -) +) : DataMapper { + override fun toDomain(): UnrecordedSchedule { + return UnrecordedSchedule( + id = id, + relation = relation.toDomain(), + day = day, + event = event, + alarm = alarm, + time = time, + link = link, + location = location + ) + } +} @Serializable data class GetUnrecordedScheduleItemRelationRes( @@ -38,5 +58,11 @@ data class GetUnrecordedScheduleItemRelationRes( val id: Long, @SerialName("name") val name: String -) - +) : DataMapper { + override fun toDomain(): UnrecordedScheduleRelation { + return UnrecordedScheduleRelation( + id = id, + name = name + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetGroupStatisticsRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetGroupStatisticsRes.kt index 09278fb0..0fb6382f 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetGroupStatisticsRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetGroupStatisticsRes.kt @@ -1,5 +1,7 @@ package ac.dnd.bookkeeping.android.data.remote.network.model.statistics +import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper +import ac.dnd.bookkeeping.android.domain.model.statistics.GroupStatistics import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -17,4 +19,15 @@ data class GetGroupStatisticsRes( val bizopen: Long, @SerialName("etc") val etc: Long, -) +) : DataMapper { + override fun toDomain(): GroupStatistics { + return GroupStatistics( + marriage = marriage, + birth = birth, + baby = baby, + babyBirth = babyBirth, + bizopen = bizopen, + etc = etc + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetMyStatisticsRes.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetMyStatisticsRes.kt index 8dd21f81..55fd9f54 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetMyStatisticsRes.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/statistics/GetMyStatisticsRes.kt @@ -1,5 +1,10 @@ package ac.dnd.bookkeeping.android.data.remote.network.model.statistics +import ac.dnd.bookkeeping.android.data.remote.mapper.DataMapper +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatistics +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsEvent +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsGive +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsTake import kotlinx.datetime.LocalDate import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -10,19 +15,38 @@ data class GetMyStatisticsRes( val give: GetMyStatisticsGiveRes, @SerialName("take") val take: GetMyStatisticsTakeRes -) +) : DataMapper { + override fun toDomain(): MyStatistics { + return MyStatistics( + give = give.toDomain(), + take = take.toDomain() + ) + } +} @Serializable data class GetMyStatisticsGiveRes( @SerialName("event") val event: List -) +) : DataMapper { + override fun toDomain(): MyStatisticsGive { + return MyStatisticsGive( + event = event.map { it.toDomain() } + ) + } +} @Serializable data class GetMyStatisticsTakeRes( @SerialName("event") val event: List -) +) : DataMapper { + override fun toDomain(): MyStatisticsTake { + return MyStatisticsTake( + event = event.map { it.toDomain() } + ) + } +} @Serializable data class GetMyStatisticsEventRes( @@ -34,4 +58,13 @@ data class GetMyStatisticsEventRes( val money: Long, @SerialName("day") val day: LocalDate -) +) : DataMapper { + override fun toDomain(): MyStatisticsEvent { + return MyStatisticsEvent( + name = name, + group = group, + money = money, + day = day + ) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/MockAuthenticationRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/MockAuthenticationRepository.kt index 37eeaa87..868b7cb6 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/MockAuthenticationRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/MockAuthenticationRepository.kt @@ -2,8 +2,8 @@ package ac.dnd.bookkeeping.android.data.repository.authentication import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager import ac.dnd.bookkeeping.android.domain.model.authentication.JwtToken -import ac.dnd.bookkeeping.android.domain.model.authentication.Login -import ac.dnd.bookkeeping.android.domain.model.authentication.Register +import ac.dnd.bookkeeping.android.domain.model.legacy.Login +import ac.dnd.bookkeeping.android.domain.model.legacy.Register import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository import kotlinx.coroutines.delay import javax.inject.Inject diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/RealAuthenticationRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/RealAuthenticationRepository.kt index 4085e963..4ad08a2d 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/RealAuthenticationRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/authentication/RealAuthenticationRepository.kt @@ -3,8 +3,8 @@ package ac.dnd.bookkeeping.android.data.repository.authentication import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager import ac.dnd.bookkeeping.android.data.remote.network.api.AuthenticationApi import ac.dnd.bookkeeping.android.domain.model.authentication.JwtToken -import ac.dnd.bookkeeping.android.domain.model.authentication.Login -import ac.dnd.bookkeeping.android.domain.model.authentication.Register +import ac.dnd.bookkeeping.android.domain.model.legacy.Login +import ac.dnd.bookkeeping.android.domain.model.legacy.Register import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository import javax.inject.Inject diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/MockGroupRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/MockGroupRepository.kt new file mode 100644 index 00000000..ee018a17 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/MockGroupRepository.kt @@ -0,0 +1,56 @@ +package ac.dnd.bookkeeping.android.data.repository.group + +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import kotlinx.coroutines.delay +import javax.inject.Inject + +class MockGroupRepository @Inject constructor() : GroupRepository { + + override suspend fun addGroup( + name: String + ): Result { + randomShortDelay() + return Result.success(-1) + } + + override suspend fun editGroup( + id: Long, + name: String + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun deleteGroup( + id: Long + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun getGroupList(): Result> { + randomLongDelay() + return Result.success( + listOf( + Group(1, "Group 1"), + Group(2, "Group 2"), + Group(3, "Group 3"), + Group(4, "Group 4"), + Group(5, "Group 5"), + Group(6, "Group 6"), + Group(7, "Group 7"), + Group(8, "Group 8"), + Group(9, "Group 9") + ) + ) + } + + private suspend fun randomShortDelay() { + delay(LongRange(100, 500).random()) + } + + private suspend fun randomLongDelay() { + delay(LongRange(500, 2000).random()) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/RealGroupRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/RealGroupRepository.kt new file mode 100644 index 00000000..97311240 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/group/RealGroupRepository.kt @@ -0,0 +1,43 @@ +package ac.dnd.bookkeeping.android.data.repository.group + +import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager +import ac.dnd.bookkeeping.android.data.remote.network.api.GroupApi +import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import javax.inject.Inject + +class RealGroupRepository @Inject constructor( + private val groupApi: GroupApi, + private val sharedPreferencesManager: SharedPreferencesManager +) : GroupRepository { + override suspend fun addGroup( + name: String + ): Result { + return groupApi.addGroup( + name = name + ).toDomain() + } + + override suspend fun editGroup( + id: Long, + name: String + ): Result { + return groupApi.editGroup( + id = id, + name = name + ) + } + + override suspend fun deleteGroup( + id: Long + ): Result { + return groupApi.deleteGroup( + id = id + ) + } + + override suspend fun getGroupList(): Result> { + return groupApi.getGroupList().toDomain() + } +} 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 new file mode 100644 index 00000000..14ea6f35 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/MockHeartRepository.kt @@ -0,0 +1,165 @@ +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.RelatedHeart +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import kotlinx.coroutines.delay +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class MockHeartRepository @Inject constructor() : HeartRepository { + + override suspend fun addHeart( + relationId: Long, + give: Boolean, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + randomShortDelay() + return Result.success(-1) + } + + override suspend fun editHeart( + id: Long, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun deleteHeart( + id: Long + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun addUnrecordedHeart( + scheduleId: Long, + money: Long, + tags: List + ): Result { + randomShortDelay() + return Result.success(-1) + } + + override suspend fun getHeartList( + sort: String, + name: String + ): Result> { + randomShortDelay() + return Result.success( + listOf( + Heart( + id = 2059, + relationId = 4920, + give = false, + name = "Lorie Adams", + group = HeartGroup( + id = 7435, + name = "Octavio Hayes" + ), + giveHistories = listOf( + 1_000L, + 2_000L, + 3_000L, + 10_000L, + 100_000L, + 1_000_000L + ), + takeHistories = listOf( + 1_000L, + 2_000L, + 3_000L, + 10_000L, + 100_000L, + 1_000_000L + ) + ), + Heart( + id = 6007, + relationId = 5328, + give = true, + name = "Jody Huffman", + group = HeartGroup( + id = 1855, + name = "Randi Sweet" + ), + giveHistories = listOf( + 1_000L, + 2_000L, + 3_000L, + 10_000L, + 100_000L, + 1_000_000L + ), + takeHistories = listOf( + 1_000L, + 2_000L, + 3_000L, + 10_000L, + 100_000L, + 1_000_000L + ) + ) + ) + ) + } + + override suspend fun getRelatedHeartList( + id: Long, + sort: String + ): Result> { + randomShortDelay() + return Result.success( + listOf( + RelatedHeart( + id = 7558, + give = false, + money = 7166, + day = LocalDate(2030, 1, 1), + event = "mediocritatem", + memo = "luptatum", + tags = listOf( + "tag1", + "tag2", + "tag3", + "tag4", + "tag5" + ) + ), + RelatedHeart( + id = 4800, + give = true, + money = 8491, + day = LocalDate(2024, 2, 25), + event = "tristique", + memo = "suavitate", + tags = listOf( + "tag1", + "tag2", + "tag3", + "tag4", + "tag5" + ) + ) + ) + ) + } + + private suspend fun randomShortDelay() { + delay(LongRange(100, 500).random()) + } + + private suspend fun randomLongDelay() { + delay(LongRange(500, 2000).random()) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/RealHeartRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/RealHeartRepository.kt new file mode 100644 index 00000000..2a402bc8 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/heart/RealHeartRepository.kt @@ -0,0 +1,95 @@ +package ac.dnd.bookkeeping.android.data.repository.heart + +import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager +import ac.dnd.bookkeeping.android.data.remote.network.api.HeartApi +import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.model.heart.Heart +import ac.dnd.bookkeeping.android.domain.model.heart.RelatedHeart +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import ac.dnd.bookkeeping.android.domain.repository.HeartRepository +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class RealHeartRepository @Inject constructor( + private val heartApi: HeartApi, + private val sharedPreferencesManager: SharedPreferencesManager +) : HeartRepository { + override suspend fun addHeart( + relationId: Long, + give: Boolean, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + return heartApi.addHeart( + relationId = relationId, + give = give, + money = money, + day = day, + event = event, + memo = memo, + tags = tags + ).toDomain() + } + + override suspend fun editHeart( + id: Long, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result { + return heartApi.editHeart( + id = id, + money = money, + day = day, + event = event, + memo = memo, + tags = tags + ) + } + + override suspend fun deleteHeart( + id: Long + ): Result { + return heartApi.deleteHeart( + id = id + ) + } + + override suspend fun addUnrecordedHeart( + scheduleId: Long, + money: Long, + tags: List + ): Result { + return heartApi.addUnrecordedHeart( + scheduleId = scheduleId, + money = money, + tags = tags + ).toDomain() + } + + override suspend fun getHeartList( + sort: String, + name: String + ): Result> { + return heartApi.getHeartList( + sort = sort, + name = name + ).toDomain() + } + + override suspend fun getRelatedHeartList( + id: Long, + sort: String + ): Result> { + return heartApi.getRelatedHeartList( + id = id, + sort = sort + ).toDomain() + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/MockMemberRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/MockMemberRepository.kt index 5570db1b..47b21c76 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/MockMemberRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/MockMemberRepository.kt @@ -2,6 +2,7 @@ package ac.dnd.bookkeeping.android.data.repository.member import ac.dnd.bookkeeping.android.domain.repository.MemberRepository import kotlinx.coroutines.delay +import kotlinx.datetime.LocalDate import javax.inject.Inject class MockMemberRepository @Inject constructor() : MemberRepository { @@ -12,6 +13,16 @@ class MockMemberRepository @Inject constructor() : MemberRepository { return Result.success(true) } + override suspend fun editProfile( + profileImageUrl: String, + nickname: String, + gender: String, + birth: LocalDate + ): Result { + randomShortDelay() + return Result.success(Unit) + } + private suspend fun randomShortDelay() { delay(LongRange(100, 500).random()) } diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/RealMemberRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/RealMemberRepository.kt index df93ba85..f4ec0036 100644 --- a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/RealMemberRepository.kt +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/member/RealMemberRepository.kt @@ -3,6 +3,7 @@ package ac.dnd.bookkeeping.android.data.repository.member import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager import ac.dnd.bookkeeping.android.data.remote.network.api.MemberApi import ac.dnd.bookkeeping.android.domain.repository.MemberRepository +import kotlinx.datetime.LocalDate import javax.inject.Inject class RealMemberRepository @Inject constructor( @@ -18,4 +19,18 @@ class RealMemberRepository @Inject constructor( checkNickname.result } } + + override suspend fun editProfile( + profileImageUrl: String, + nickname: String, + gender: String, + birth: LocalDate + ): Result { + return memberApi.editProfile( + profileImageUrl = profileImageUrl, + nickname = nickname, + gender = gender, + birth = birth + ) + } } diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/MockRelationRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/MockRelationRepository.kt new file mode 100644 index 00000000..1104d0ac --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/MockRelationRepository.kt @@ -0,0 +1,100 @@ +package ac.dnd.bookkeeping.android.data.repository.relation + +import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetail +import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetailGroup +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimple +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimpleGroup +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import kotlinx.coroutines.delay +import javax.inject.Inject + +class MockRelationRepository @Inject constructor() : RelationRepository { + + override suspend fun addRelation( + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + randomShortDelay() + return Result.success(-1) + } + + override suspend fun editRelation( + id: Long, + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun deleteRelation( + id: Long + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun getRelation( + id: Long + ): Result { + randomShortDelay() + return Result.success( + RelationDetail( + id = 5902, + name = "Mandy Dillard", + group = RelationDetailGroup( + id = 6945, + name = "Alba Sargent" + ), + giveMoney = 5834, + takeMoney = 9884 + ) + ) + } + + override suspend fun getRelationList( + name: String + ): Result> { + randomLongDelay() + return Result.success( + listOf( + RelationSimple( + id = 2290, + name = "Concepcion Watts", + group = RelationSimpleGroup( + id = 7722, + name = "Enid Patton" + ) + ), + RelationSimple( + id = 5606, + name = "Lora Meadows", + group = RelationSimpleGroup( + id = 7709, + name = "Corinne Porter" + ) + ), + RelationSimple( + id = 5902, + name = "Mandy Dillard", + group = RelationSimpleGroup( + id = 6945, + name = "Alba Sargent" + ) + ) + ) + ) + } + + private suspend fun randomShortDelay() { + delay(LongRange(100, 500).random()) + } + + private suspend fun randomLongDelay() { + delay(LongRange(500, 2000).random()) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/RealRelationRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/RealRelationRepository.kt new file mode 100644 index 00000000..dc4cfa91 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/relation/RealRelationRepository.kt @@ -0,0 +1,70 @@ +package ac.dnd.bookkeeping.android.data.repository.relation + +import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager +import ac.dnd.bookkeeping.android.data.remote.network.api.RelationApi +import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetail +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimple +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import ac.dnd.bookkeeping.android.domain.repository.RelationRepository +import javax.inject.Inject + +class RealRelationRepository @Inject constructor( + private val relationApi: RelationApi, + private val sharedPreferencesManager: SharedPreferencesManager +) : RelationRepository { + override suspend fun addRelation( + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + return relationApi.addRelation( + groupId = groupId, + name = name, + imageUrl = imageUrl, + memo = memo + ).toDomain() + } + + override suspend fun editRelation( + id: Long, + groupId: Long, + name: String, + imageUrl: String, + memo: String + ): Result { + return relationApi.editRelation( + id = id, + groupId = groupId, + name = name, + imageUrl = imageUrl, + memo = memo + ) + } + + override suspend fun deleteRelation( + id: Long + ): Result { + return relationApi.deleteRelation( + id = id + ) + } + + override suspend fun getRelation( + id: Long + ): Result { + return relationApi.getRelation( + id = id + ).toDomain() + } + + override suspend fun getRelationList( + name: String + ): Result> { + return relationApi.getRelationList( + name = name + ).toDomain() + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/MockScheduleRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/MockScheduleRepository.kt new file mode 100644 index 00000000..757f0664 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/MockScheduleRepository.kt @@ -0,0 +1,84 @@ +package ac.dnd.bookkeeping.android.data.repository.schedule + +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedSchedule +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedScheduleRelation +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import kotlinx.coroutines.delay +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime +import javax.inject.Inject + +class MockScheduleRepository @Inject constructor() : ScheduleRepository { + + override suspend fun addSchedule( + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + randomShortDelay() + return Result.success(-1) + } + + override suspend fun editSchedule( + id: Long, + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun deleteSchedule( + id: Long + ): Result { + randomShortDelay() + return Result.success(Unit) + } + + override suspend fun getUnrecordedScheduleList( + name: String + ): Result> { + randomLongDelay() + return Result.success( + listOf( + UnrecordedSchedule( + id = 2655, + relation = UnrecordedScheduleRelation( + id = 9178, + name = "Alphonse Berg" + ), + day = LocalDate(2024, 2, 25), + event = "velit", + alarm = LocalDateTime(2024, 2, 25, 8, 0), + time = LocalTime(8, 0), + link = "maximus", + location = "noster" + ) + ) + ) + } + + private suspend fun randomShortDelay() { + delay(LongRange(100, 500).random()) + } + + private suspend fun randomLongDelay() { + delay(LongRange(500, 2000).random()) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/RealScheduleRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/RealScheduleRepository.kt new file mode 100644 index 00000000..3fa718f5 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/schedule/RealScheduleRepository.kt @@ -0,0 +1,88 @@ +package ac.dnd.bookkeeping.android.data.repository.schedule + +import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager +import ac.dnd.bookkeeping.android.data.remote.network.api.ScheduleApi +import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedSchedule +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime +import javax.inject.Inject + +class RealScheduleRepository @Inject constructor( + private val scheduleApi: ScheduleApi, + private val sharedPreferencesManager: SharedPreferencesManager +) : ScheduleRepository { + override suspend fun addSchedule( + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + return scheduleApi.addSchedule( + relationId = relationId, + day = day, + event = event, + repeatType = repeatType, + repeatFinish = repeatFinish, + alarm = alarm, + time = time, + link = link, + location = location, + memo = memo + ).toDomain() + } + + override suspend fun editSchedule( + id: Long, + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String + ): Result { + return scheduleApi.editSchedule( + id = id, + relationId = relationId, + day = day, + event = event, + repeatType = repeatType, + repeatFinish = repeatFinish, + alarm = alarm, + time = time, + link = link, + location = location, + memo = memo + ) + } + + override suspend fun deleteSchedule( + id: Long + ): Result { + return scheduleApi.deleteSchedule( + id = id + ) + } + + override suspend fun getUnrecordedScheduleList( + name: String + ): Result> { + return scheduleApi.getUnrecordedScheduleList( + name = name + ).toDomain() + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/MockStatisticsRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/MockStatisticsRepository.kt new file mode 100644 index 00000000..b97009bf --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/MockStatisticsRepository.kt @@ -0,0 +1,82 @@ +package ac.dnd.bookkeeping.android.data.repository.statistics + +import ac.dnd.bookkeeping.android.domain.model.statistics.GroupStatistics +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatistics +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsEvent +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsGive +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatisticsTake +import ac.dnd.bookkeeping.android.domain.repository.StatisticsRepository +import kotlinx.coroutines.delay +import kotlinx.datetime.LocalDate +import javax.inject.Inject + +class MockStatisticsRepository @Inject constructor() : StatisticsRepository { + + override suspend fun getMyStatistics( + year: Int, + month: Int? + ): Result { + randomLongDelay() + return Result.success( + MyStatistics( + give = MyStatisticsGive( + event = listOf( + MyStatisticsEvent( + name = "Deirdre Guerra", + group = "veri", + money = 4162, + day = LocalDate(2021, 10, 1) + ), + MyStatisticsEvent( + name = "Merritt Mccarthy", + group = "ex", + money = 9402, + day = LocalDate(2021, 10, 1) + ), + ) + ), + take = MyStatisticsTake( + event = listOf( + MyStatisticsEvent( + name = "Calvin Romero", + group = "ex", + money = 9402, + day = LocalDate(2021, 10, 1) + ), + MyStatisticsEvent( + name = "Merritt Mccarthy", + group = "ex", + money = 9402, + day = LocalDate(2021, 10, 1) + ), + ) + ) + ) + ) + } + + override suspend fun getGroupStatistics( + gender: String, + range: Int + ): Result { + randomShortDelay() + return Result.success( + GroupStatistics( + marriage = 3123, + birth = 7383, + baby = 9370, + babyBirth = 4026, + bizopen = 3068, + etc = 3819 + ) + ) + } + + private suspend fun randomShortDelay() { + delay(LongRange(100, 500).random()) + } + + private suspend fun randomLongDelay() { + delay(LongRange(500, 2000).random()) + } +} diff --git a/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/RealStatisticsRepository.kt b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/RealStatisticsRepository.kt new file mode 100644 index 00000000..97e920f2 --- /dev/null +++ b/data/src/main/kotlin/ac/dnd/bookkeeping/android/data/repository/statistics/RealStatisticsRepository.kt @@ -0,0 +1,36 @@ +package ac.dnd.bookkeeping.android.data.repository.statistics + +import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager +import ac.dnd.bookkeeping.android.data.remote.network.api.StatisticsApi +import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain +import ac.dnd.bookkeeping.android.domain.model.group.Group +import ac.dnd.bookkeeping.android.domain.model.statistics.GroupStatistics +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatistics +import ac.dnd.bookkeeping.android.domain.repository.GroupRepository +import ac.dnd.bookkeeping.android.domain.repository.StatisticsRepository +import javax.inject.Inject + +class RealStatisticsRepository @Inject constructor( + private val statisticsApi: StatisticsApi, + private val sharedPreferencesManager: SharedPreferencesManager +) : StatisticsRepository { + override suspend fun getMyStatistics( + year: Int, + month: Int? + ): Result { + return statisticsApi.getMyStatistics( + year = year, + month = month + ).toDomain() + } + + override suspend fun getGroupStatistics( + gender: String, + range: Int + ): Result { + return statisticsApi.getGroupStatistics( + gender = gender, + range = range + ).toDomain() + } +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Login.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Login.kt deleted file mode 100644 index 87678d36..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Login.kt +++ /dev/null @@ -1,5 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.model.authentication - -data class Login( - val isNew: Boolean -) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Register.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Register.kt deleted file mode 100644 index e778a572..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Register.kt +++ /dev/null @@ -1,5 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.model.authentication - -data class Register( - val id: Long -) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Group.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Group.kt deleted file mode 100644 index fb920f95..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Group.kt +++ /dev/null @@ -1,7 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.model.event - -data class Group( - val id: Long, - val name: String, - val relations: List -) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Relation.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Relation.kt deleted file mode 100644 index fbccb3dd..00000000 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/event/Relation.kt +++ /dev/null @@ -1,14 +0,0 @@ -package ac.dnd.bookkeeping.android.domain.model.event - -data class Relation( - val id: Long, - val name: String, - val group: RelationGroup, - val giveMoney: Long, - val takeMoney: Long -) - -data class RelationGroup( - val id: Long, - val name: String -) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/group/Group.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/group/Group.kt new file mode 100644 index 00000000..ecb657d3 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/group/Group.kt @@ -0,0 +1,6 @@ +package ac.dnd.bookkeeping.android.domain.model.group + +data class Group( + val id: Long, + val name: String +) 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 new file mode 100644 index 00000000..4feecd2d --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/Heart.kt @@ -0,0 +1,17 @@ +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 giveHistories: List, + val takeHistories: List +) + +data class HeartGroup( + 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 new file mode 100644 index 00000000..7b70c5b9 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/heart/RelatedHeart.kt @@ -0,0 +1,14 @@ +package ac.dnd.bookkeeping.android.domain.model.heart + +import kotlinx.datetime.LocalDate + +data class RelatedHeart( + val id: Long, + val give: Boolean, + val money: Long, + val day: LocalDate, + val event: String, + val memo: String, + val tags: List +) + diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/GroupLegacy.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/GroupLegacy.kt new file mode 100644 index 00000000..42e6f01a --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/GroupLegacy.kt @@ -0,0 +1,7 @@ +package ac.dnd.bookkeeping.android.domain.model.legacy + +data class GroupLegacy( + val id: Long, + val name: String, + val relations: List +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/history/HistoryInfo.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/HistoryInfoLegacy.kt similarity index 51% rename from domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/history/HistoryInfo.kt rename to domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/HistoryInfoLegacy.kt index f70cef04..ad1410c9 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/history/HistoryInfo.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/HistoryInfoLegacy.kt @@ -1,6 +1,6 @@ -package ac.dnd.bookkeeping.android.domain.model.history +package ac.dnd.bookkeeping.android.domain.model.legacy -data class HistoryInfo( +data class HistoryInfoLegacy( val unWrittenCount: Int, val totalHeartCount: Int, val unReadAlarm: Boolean diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Login.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Login.kt new file mode 100644 index 00000000..4fcac3ec --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Login.kt @@ -0,0 +1,5 @@ +package ac.dnd.bookkeeping.android.domain.model.legacy + +data class Login( + val isNew: Boolean +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Register.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Register.kt new file mode 100644 index 00000000..118fe259 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/Register.kt @@ -0,0 +1,5 @@ +package ac.dnd.bookkeeping.android.domain.model.legacy + +data class Register( + val id: Long +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/RelationLegacy.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/RelationLegacy.kt new file mode 100644 index 00000000..efacf67d --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/legacy/RelationLegacy.kt @@ -0,0 +1,14 @@ +package ac.dnd.bookkeeping.android.domain.model.legacy + +data class RelationLegacy( + val id: Long, + val name: String, + val group: RelationGroupLegacy, + val giveMoney: Long, + val takeMoney: Long +) + +data class RelationGroupLegacy( + val id: Long, + val name: String +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/member/Profile.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/member/Profile.kt new file mode 100644 index 00000000..68fc79fb --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/member/Profile.kt @@ -0,0 +1,10 @@ +package ac.dnd.bookkeeping.android.domain.model.member + +import kotlinx.datetime.LocalDate + +data class Profile( + val name: String, + val nickname: String, + val gender: String, + val birth: LocalDate +) 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 new file mode 100644 index 00000000..0afc7770 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationDetail.kt @@ -0,0 +1,15 @@ +package ac.dnd.bookkeeping.android.domain.model.relation + +data class RelationDetail( + val id: Long, + val name: String, + val group: RelationDetailGroup, + val giveMoney: Long, + val takeMoney: Long +) + +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 new file mode 100644 index 00000000..a15ce3e2 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/relation/RelationSimple.kt @@ -0,0 +1,13 @@ +package ac.dnd.bookkeeping.android.domain.model.relation + +data class RelationSimple( + val id: Long, + val name: String, + val group: RelationSimpleGroup, +) + +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 new file mode 100644 index 00000000..766a9d88 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/schedule/UnrecordedSchedule.kt @@ -0,0 +1,22 @@ +package ac.dnd.bookkeeping.android.domain.model.schedule + +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime + +data class UnrecordedSchedule( + val id: Long, + val relation: UnrecordedScheduleRelation, + val day: LocalDate, + val event: String, + val alarm: LocalDateTime, + val time: LocalTime, + val link: String, + val location: String +) + +data class UnrecordedScheduleRelation( + val id: Long, + val name: String +) + diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/GroupStatistics.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/GroupStatistics.kt new file mode 100644 index 00000000..59a804a7 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/GroupStatistics.kt @@ -0,0 +1,10 @@ +package ac.dnd.bookkeeping.android.domain.model.statistics + +data class GroupStatistics( + val marriage: Long, + val birth: Long, + val baby: Long, + val babyBirth: Long, + val bizopen: Long, + val etc: Long, +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/MyStatistics.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/MyStatistics.kt new file mode 100644 index 00000000..a1a01ca3 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/statistics/MyStatistics.kt @@ -0,0 +1,23 @@ +package ac.dnd.bookkeeping.android.domain.model.statistics + +import kotlinx.datetime.LocalDate + +data class MyStatistics( + val give: MyStatisticsGive, + val take: MyStatisticsTake +) + +data class MyStatisticsGive( + val event: List +) + +data class MyStatisticsTake( + val event: List +) + +data class MyStatisticsEvent( + val name: String, + val group: String, + val money: Long, + val day: LocalDate +) diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/AuthenticationRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/AuthenticationRepository.kt index e2e5ecdc..d5070c96 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/AuthenticationRepository.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/AuthenticationRepository.kt @@ -1,8 +1,8 @@ package ac.dnd.bookkeeping.android.domain.repository import ac.dnd.bookkeeping.android.domain.model.authentication.JwtToken -import ac.dnd.bookkeeping.android.domain.model.authentication.Login -import ac.dnd.bookkeeping.android.domain.model.authentication.Register +import ac.dnd.bookkeeping.android.domain.model.legacy.Login +import ac.dnd.bookkeeping.android.domain.model.legacy.Register interface AuthenticationRepository { diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/GroupRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/GroupRepository.kt new file mode 100644 index 00000000..77c81e72 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/GroupRepository.kt @@ -0,0 +1,21 @@ +package ac.dnd.bookkeeping.android.domain.repository + +import ac.dnd.bookkeeping.android.domain.model.group.Group + +interface GroupRepository { + + suspend fun addGroup( + name: String + ): Result + + suspend fun editGroup( + id: Long, + name: String + ): Result + + suspend fun deleteGroup( + id: Long, + ): Result + + suspend fun getGroupList(): Result> +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/HeartRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/HeartRepository.kt new file mode 100644 index 00000000..163d6cf3 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/HeartRepository.kt @@ -0,0 +1,47 @@ +package ac.dnd.bookkeeping.android.domain.repository + +import ac.dnd.bookkeeping.android.domain.model.heart.Heart +import ac.dnd.bookkeeping.android.domain.model.heart.RelatedHeart +import kotlinx.datetime.LocalDate + +interface HeartRepository { + + suspend fun addHeart( + relationId: Long, + give: Boolean, + money: Long, + day: LocalDate, + event: String, + memo: String, + tags: List + ): Result + + suspend fun editHeart( + id: Long, + money: Long, + day: LocalDate, + event: String, + memo: String = "", + tags: List + ): Result + + suspend fun deleteHeart( + id: Long, + ): Result + + suspend fun addUnrecordedHeart( + scheduleId: Long, + money: Long, + tags: List + ): Result + + suspend fun getHeartList( + sort: String = "recent", + name: String = "" + ): Result> + + suspend fun getRelatedHeartList( + id: Long, + sort: String = "recent" + ): Result> +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/MemberRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/MemberRepository.kt index 43d0b6e8..79d1236b 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/MemberRepository.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/MemberRepository.kt @@ -1,7 +1,16 @@ package ac.dnd.bookkeeping.android.domain.repository +import kotlinx.datetime.LocalDate + interface MemberRepository { suspend fun checkNickname( nickname: String ): Result + + suspend fun editProfile( + profileImageUrl: String, + nickname: String, + gender: String, + birth: LocalDate + ): Result } diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/RelationRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/RelationRepository.kt new file mode 100644 index 00000000..92801e14 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/RelationRepository.kt @@ -0,0 +1,34 @@ +package ac.dnd.bookkeeping.android.domain.repository + +import ac.dnd.bookkeeping.android.domain.model.relation.RelationDetail +import ac.dnd.bookkeeping.android.domain.model.relation.RelationSimple + +interface RelationRepository { + + suspend fun addRelation( + groupId: Long, + name: String, + imageUrl: String, + memo: String = "" + ): Result + + suspend fun editRelation( + id: Long, + groupId: Long, + name: String, + imageUrl: String, + memo: String = "" + ): Result + + suspend fun deleteRelation( + id: Long, + ): Result + + suspend fun getRelation( + id: Long + ): Result + + suspend fun getRelationList( + name: String = "" + ): Result> +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/ScheduleRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/ScheduleRepository.kt new file mode 100644 index 00000000..7a5d1da6 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/ScheduleRepository.kt @@ -0,0 +1,44 @@ +package ac.dnd.bookkeeping.android.domain.repository + +import ac.dnd.bookkeeping.android.domain.model.schedule.UnrecordedSchedule +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime + +interface ScheduleRepository { + + suspend fun addSchedule( + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String = "", + ): Result + + suspend fun editSchedule( + id: Long, + relationId: Long, + day: LocalDate, + event: String, + repeatType: String, + repeatFinish: LocalDate, + alarm: LocalDateTime, + time: LocalTime, + link: String, + location: String, + memo: String = "", + ): Result + + suspend fun deleteSchedule( + id: Long, + ): Result + + suspend fun getUnrecordedScheduleList( + name: String = "" + ): Result> +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/StatisticsRepository.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/StatisticsRepository.kt new file mode 100644 index 00000000..ec02e630 --- /dev/null +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/StatisticsRepository.kt @@ -0,0 +1,17 @@ +package ac.dnd.bookkeeping.android.domain.repository + +import ac.dnd.bookkeeping.android.domain.model.statistics.GroupStatistics +import ac.dnd.bookkeeping.android.domain.model.statistics.MyStatistics + +interface StatisticsRepository { + + suspend fun getMyStatistics( + year: Int, + month: Int? = null + ): Result + + suspend fun getGroupStatistics( + gender: String, + range: Int + ): Result +} diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LoginUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LoginUseCase.kt index 873ead8a..6c308088 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LoginUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LoginUseCase.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.domain.usecase.authentication -import ac.dnd.bookkeeping.android.domain.model.authentication.Login +import ac.dnd.bookkeeping.android.domain.model.legacy.Login import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository import javax.inject.Inject diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/RegistrationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/RegistrationUseCase.kt index 0508574b..f9f1e6fc 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/RegistrationUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/RegistrationUseCase.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.domain.usecase.authentication -import ac.dnd.bookkeeping.android.domain.model.authentication.Register +import ac.dnd.bookkeeping.android.domain.model.legacy.Register import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository import javax.inject.Inject diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt index e11ad619..a60c5c1b 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryGroupListUseCase.kt @@ -1,8 +1,8 @@ package ac.dnd.bookkeeping.android.domain.usecase.history -import ac.dnd.bookkeeping.android.domain.model.event.Group -import ac.dnd.bookkeeping.android.domain.model.event.Relation -import ac.dnd.bookkeeping.android.domain.model.event.RelationGroup +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy import javax.inject.Inject class GetHistoryGroupListUseCase @Inject constructor( @@ -10,69 +10,69 @@ class GetHistoryGroupListUseCase @Inject constructor( ) { suspend operator fun invoke( historyType: String - ): Result> { + ): Result> { return Result.success( when (historyType) { "take" -> { listOf( - Group( + GroupLegacy( 1, "전체-받은 마음", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), giveMoney = 20, takeMoney = 1000000 ), - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), giveMoney = 100000, takeMoney = 0 ), - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), giveMoney = 100000, takeMoney = 23 ), - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 12312223, takeMoney = 12 ), - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -81,14 +81,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 2, "친구", listOf( - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), @@ -97,14 +97,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 3, "가족", listOf( - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), @@ -113,24 +113,24 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 4, "지인", listOf( - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), @@ -139,14 +139,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 5, "직장", listOf( - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -155,14 +155,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 6, "사촌", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), @@ -176,64 +176,64 @@ class GetHistoryGroupListUseCase @Inject constructor( "give" -> { listOf( - Group( + GroupLegacy( 1, "전체-준마음", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), giveMoney = 20, takeMoney = 1000000 ), - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), giveMoney = 100000, takeMoney = 0 ), - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), giveMoney = 100000, takeMoney = 23 ), - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 12231223, takeMoney = 12 ), - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -242,14 +242,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 2, "친구", listOf( - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), @@ -258,14 +258,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 3, "가족", listOf( - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), @@ -274,24 +274,24 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 4, "지인", listOf( - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), @@ -300,14 +300,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 5, "직장", listOf( - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -316,14 +316,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 6, "사촌", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), @@ -337,64 +337,64 @@ class GetHistoryGroupListUseCase @Inject constructor( else -> { listOf( - Group( + GroupLegacy( 1, "전체-전체", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), giveMoney = 20, takeMoney = 10000000 ), - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), giveMoney = 1000000, takeMoney = 0 ), - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), giveMoney = 10000000, takeMoney = 23 ), - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 123121223, takeMoney = 12 ), - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -403,14 +403,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 2, "친구", listOf( - Relation( + RelationLegacy( id = 5, name = "김경민", - group = RelationGroup( + group = RelationGroupLegacy( id = 4, name = "친구", ), @@ -419,14 +419,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 3, "가족", listOf( - Relation( + RelationLegacy( id = 0, name = "김진우", - group = RelationGroup( + group = RelationGroupLegacy( id = 0, name = "가족", ), @@ -435,24 +435,24 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 4, "지인", listOf( - Relation( + RelationLegacy( id = 1, name = "박예리나", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), giveMoney = 0, takeMoney = 0 ), - Relation( + RelationLegacy( id = 2, name = "이다빈", - group = RelationGroup( + group = RelationGroupLegacy( id = 1, name = "지인", ), @@ -461,14 +461,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 5, "직장", listOf( - Relation( + RelationLegacy( id = 3, name = "장성혁", - group = RelationGroup( + group = RelationGroupLegacy( id = 2, name = "직장", ), @@ -477,14 +477,14 @@ class GetHistoryGroupListUseCase @Inject constructor( ), ) ), - Group( + GroupLegacy( 6, "사촌", listOf( - Relation( + RelationLegacy( id = 4, name = "서지원", - group = RelationGroup( + group = RelationGroupLegacy( id = 3, name = "사촌", ), diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt index 57ffea57..29686f4e 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/history/GetHistoryInfoUseCase.kt @@ -1,15 +1,15 @@ package ac.dnd.bookkeeping.android.domain.usecase.history -import ac.dnd.bookkeeping.android.domain.model.history.HistoryInfo +import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import javax.inject.Inject class GetHistoryInfoUseCase @Inject constructor( ) { - suspend operator fun invoke(): Result { + suspend operator fun invoke(): Result { // TODO fix when api update return Result.success( - HistoryInfo( + HistoryInfoLegacy( unWrittenCount = 5, totalHeartCount = 32, unReadAlarm = false diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt index b90485ac..d798b000 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/member/GetGroupListUseCase.kt @@ -1,46 +1,46 @@ package ac.dnd.bookkeeping.android.domain.usecase.member -import ac.dnd.bookkeeping.android.domain.model.event.Group -import ac.dnd.bookkeeping.android.domain.model.event.Relation -import ac.dnd.bookkeeping.android.domain.model.event.RelationGroup +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy import ac.dnd.bookkeeping.android.domain.repository.MemberRepository import javax.inject.Inject class GetGroupListUseCase @Inject constructor( private val memberRepository: MemberRepository ) { - suspend operator fun invoke(): Result> { + suspend operator fun invoke(): Result> { // TODO return Result.success( listOf( - Group( + GroupLegacy( id = 2337, name = "Angelia McBride", relations = listOf( - Relation( + RelationLegacy( id = 9922, name = "Patty Meadows", - group = RelationGroup( + group = RelationGroupLegacy( id = 2337, name = "Angelia McBride", ), giveMoney = 8246, takeMoney = 5441 ), - Relation( + RelationLegacy( id = 1447, name = "Margery Hyde", - group = RelationGroup( + group = RelationGroupLegacy( id = 2337, name = "Angelia McBride", ), giveMoney = 2859, takeMoney = 1341 ), - Relation( + RelationLegacy( id = 8446, name = "Harlan Yang", - group = RelationGroup( + group = RelationGroupLegacy( id = 2337, name = "Angelia McBride", ), @@ -49,14 +49,14 @@ class GetGroupListUseCase @Inject constructor( ) ) ), - Group( + GroupLegacy( id = 6599, name = "Andrea Serrano", relations = listOf( - Relation( + RelationLegacy( id = 3679, name = "Jerome Pitts", - group = RelationGroup( + group = RelationGroupLegacy( id = 6599, name = "Andrea Serrano", ), diff --git a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt index efc278a2..97622226 100644 --- a/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt +++ b/domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/relation/GetRelationUseCase.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.domain.usecase.relation -import ac.dnd.bookkeeping.android.domain.model.event.Relation -import ac.dnd.bookkeeping.android.domain.model.event.RelationGroup +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy import javax.inject.Inject class GetRelationUseCase @Inject constructor( @@ -9,13 +9,13 @@ class GetRelationUseCase @Inject constructor( ) { suspend operator fun invoke( id: Long - ): Result { + ): Result { // TODO return Result.success( - Relation( + RelationLegacy( id = 6710, name = "Harrison House", - group = RelationGroup( + group = RelationGroupLegacy( id = 5104, name = "Casandra Reynolds" ), 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 392a73c6..f4990dc7 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 @@ -1,8 +1,8 @@ package ac.dnd.bookkeeping.android.presentation.common.view.chip -import ac.dnd.bookkeeping.android.domain.model.event.Group -import ac.dnd.bookkeeping.android.domain.model.event.Relation -import ac.dnd.bookkeeping.android.domain.model.event.RelationGroup +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items @@ -15,8 +15,8 @@ import androidx.compose.ui.unit.dp fun GroupChipListComponent( chipType: ChipType = ChipType.LESS_BORDER, currentSelectedId: Long, - onSelectChip: (Group) -> Unit, - groups : List + onSelectChip: (GroupLegacy) -> Unit, + groups : List ) { LazyRow(horizontalArrangement = Arrangement.spacedBy(6.dp)) { items(groups) { group -> @@ -42,14 +42,14 @@ fun GroupChipPreview() { currentSelectedId = 0, onSelectChip = {}, groups = listOf( - Group( + GroupLegacy( 0, "전체", relations = listOf( - Relation( + RelationLegacy( id = 3679, name = "Jerome Pitts", - group = RelationGroup( + group = RelationGroupLegacy( id = 6599, name = "Andrea Serrano", ), @@ -58,14 +58,14 @@ fun GroupChipPreview() { ) ) ), - Group( + GroupLegacy( 1, "친구", relations = listOf( - Relation( + RelationLegacy( id = 3679, name = "Jerome Pitts", - group = RelationGroup( + group = RelationGroupLegacy( id = 6599, name = "Andrea Serrano", ), @@ -74,7 +74,7 @@ fun GroupChipPreview() { ) ) ), - Group( + GroupLegacy( 2, "가족", listOf() diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationModel.kt index 634fd6a1..9a926a6d 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationModel.kt @@ -1,10 +1,10 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation -import ac.dnd.bookkeeping.android.domain.model.event.Group +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import androidx.compose.runtime.Immutable @Immutable data class SearchRelationModel( val state: SearchRelationState, - val groups: List + val groups: List ) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationScreen.kt index 122da42b..e2332d40 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationScreen.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation -import ac.dnd.bookkeeping.android.domain.model.event.Group -import ac.dnd.bookkeeping.android.domain.model.event.Relation +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy import ac.dnd.bookkeeping.android.presentation.R import ac.dnd.bookkeeping.android.presentation.common.theme.Body0 import ac.dnd.bookkeeping.android.presentation.common.theme.Body1 @@ -67,7 +67,7 @@ import kotlinx.coroutines.CoroutineExceptionHandler fun SearchRelationScreen( appState: ApplicationState, onDismissRequest: () -> Unit, - onResult: (Relation) -> Unit, + onResult: (RelationLegacy) -> Unit, viewModel: SearchRelationViewModel = hiltViewModel() ) { val model: SearchRelationModel = Unit.let { @@ -100,10 +100,10 @@ private fun SearchRelationScreen( intent: (SearchRelationIntent) -> Unit, handler: CoroutineExceptionHandler, onDismissRequest: () -> Unit, - onResult: (Relation) -> Unit, + onResult: (RelationLegacy) -> Unit, ) { var text by remember { mutableStateOf("") } - var selectedRelation: Relation? by remember { mutableStateOf(null) } + var selectedRelation: RelationLegacy? by remember { mutableStateOf(null) } val lowerText = text.lowercase() val filteredGroups = model.groups.filter { group -> @@ -238,11 +238,11 @@ private fun SearchRelationScreen( @Composable @OptIn(ExperimentalMaterialApi::class) private fun SearchRelationGroup( - group: Group, - selectedRelation: Relation?, + group: GroupLegacy, + selectedRelation: RelationLegacy?, isExpanded: Boolean, onExpandRequest: () -> Unit, - onClick: (Relation) -> Unit + onClick: (RelationLegacy) -> Unit ) { Column( modifier = Modifier.fillMaxSize() @@ -316,9 +316,9 @@ private fun SearchRelationGroup( @Composable @OptIn(ExperimentalMaterialApi::class) private fun SearchRelationRelation( - relation: Relation, - selectedRelation: Relation?, - onClick: (Relation) -> Unit + relation: RelationLegacy, + selectedRelation: RelationLegacy?, + onClick: (RelationLegacy) -> Unit ) { Surface( modifier = Modifier diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt index 2768143b..01136454 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/event/common/relation/SearchRelationViewModel.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation import ac.dnd.bookkeeping.android.domain.model.error.ServerException -import ac.dnd.bookkeeping.android.domain.model.event.Group +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import ac.dnd.bookkeeping.android.domain.usecase.member.CheckNicknameUseCase import ac.dnd.bookkeeping.android.domain.usecase.member.GetGroupListUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel @@ -29,8 +29,8 @@ class SearchRelationViewModel @Inject constructor( private val _event: MutableEventFlow = MutableEventFlow() val event: EventFlow = _event.asEventFlow() - private val _groups: MutableStateFlow> = MutableStateFlow(emptyList()) - val groups: StateFlow> = _groups.asStateFlow() + private val _groups: MutableStateFlow> = MutableStateFlow(emptyList()) + val groups: StateFlow> = _groups.asStateFlow() init { launch { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt index cb8d6c77..3f563b1d 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/HistoryViewModel.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history import ac.dnd.bookkeeping.android.domain.model.error.ServerException -import ac.dnd.bookkeeping.android.domain.model.history.HistoryInfo +import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import ac.dnd.bookkeeping.android.domain.usecase.history.GetHistoryInfoUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow @@ -29,9 +29,9 @@ class HistoryViewModel @Inject constructor( private val _event: MutableEventFlow = MutableEventFlow() val event: EventFlow = _event.asEventFlow() - private val _historyInfo: MutableStateFlow = - MutableStateFlow(HistoryInfo(0, 0, false)) - val historyInfo: StateFlow = _historyInfo.asStateFlow() + private val _historyInfo: MutableStateFlow = + MutableStateFlow(HistoryInfoLegacy(0, 0, false)) + val historyInfo: StateFlow = _historyInfo.asStateFlow() init { launch { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainModel.kt index e26ea45e..4c14e509 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainModel.kt @@ -1,10 +1,10 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main -import ac.dnd.bookkeeping.android.domain.model.history.HistoryInfo +import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import androidx.compose.runtime.Immutable @Immutable data class HistoryMainModel( val state: HistoryMainState, - val historyInfo: HistoryInfo + val historyInfo: HistoryInfoLegacy ) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainScreen.kt index c32bc3ab..299a2640 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/HistoryMainScreen.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main -import ac.dnd.bookkeeping.android.domain.model.history.HistoryInfo +import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import ac.dnd.bookkeeping.android.presentation.R import ac.dnd.bookkeeping.android.presentation.common.theme.Gray000 import ac.dnd.bookkeeping.android.presentation.common.theme.Gray100 @@ -194,7 +194,7 @@ fun HistoryScreenPreview() { appState = rememberApplicationState(), model = HistoryMainModel( state = HistoryMainState.Init, - historyInfo = HistoryInfo( + historyInfo = HistoryInfoLegacy( unReadAlarm = true, totalHeartCount = 30, unWrittenCount = 5 diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailModel.kt index 5cd9e20a..96b01363 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailModel.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail -import ac.dnd.bookkeeping.android.domain.model.event.Group +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail.type.HistoryViewType import androidx.compose.runtime.Immutable @@ -8,5 +8,5 @@ import androidx.compose.runtime.Immutable data class HistoryDetailModel( val state: HistoryDetailState, val viewType: HistoryViewType, - val historyGroups: List, + val historyGroups: List, ) 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 5f5829b2..35d9e2e0 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 @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail -import ac.dnd.bookkeeping.android.domain.model.history.HistoryInfo +import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy import ac.dnd.bookkeeping.android.presentation.R import ac.dnd.bookkeeping.android.presentation.common.theme.Body1 import ac.dnd.bookkeeping.android.presentation.common.theme.Body2 @@ -403,7 +403,7 @@ fun HistoryDetailPreview() { HistoryViewType.TOTAL, mainModel = HistoryMainModel( state = HistoryMainState.Init, - historyInfo = HistoryInfo( + historyInfo = HistoryInfoLegacy( unReadAlarm = true, totalHeartCount = 30, unWrittenCount = 5 diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt index a6ad64dd..855a9d64 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/HistoryDetailViewModel.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail import ac.dnd.bookkeeping.android.domain.model.error.ServerException -import ac.dnd.bookkeeping.android.domain.model.event.Group +import ac.dnd.bookkeeping.android.domain.model.legacy.GroupLegacy import ac.dnd.bookkeeping.android.domain.usecase.history.GetHistoryGroupListUseCase import ac.dnd.bookkeeping.android.presentation.common.base.BaseViewModel import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.EventFlow @@ -28,14 +28,14 @@ class HistoryDetailViewModel @Inject constructor( private val _event: MutableEventFlow = MutableEventFlow() val event: EventFlow = _event.asEventFlow() - private val _totalGroups: MutableStateFlow> = MutableStateFlow(emptyList()) - val totalGroups: StateFlow> = _totalGroups.asStateFlow() + private val _totalGroups: MutableStateFlow> = MutableStateFlow(emptyList()) + val totalGroups: StateFlow> = _totalGroups.asStateFlow() - private val _takeGroups: MutableStateFlow> = MutableStateFlow(emptyList()) - val takeGroups: StateFlow> = _takeGroups.asStateFlow() + private val _takeGroups: MutableStateFlow> = MutableStateFlow(emptyList()) + val takeGroups: StateFlow> = _takeGroups.asStateFlow() - private val _giveGroups: MutableStateFlow> = MutableStateFlow(emptyList()) - val giveGroups: StateFlow> = _giveGroups.asStateFlow() + private val _giveGroups: MutableStateFlow> = MutableStateFlow(emptyList()) + val giveGroups: StateFlow> = _giveGroups.asStateFlow() init { HistoryViewType.entries.forEach { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/item/HistoryRelationItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/item/HistoryRelationItem.kt index 96c4138a..c7b9feea 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/item/HistoryRelationItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/home/history/main/detail/item/HistoryRelationItem.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main.detail.item -import ac.dnd.bookkeeping.android.domain.model.event.Relation -import ac.dnd.bookkeeping.android.domain.model.event.RelationGroup +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationLegacy +import ac.dnd.bookkeeping.android.domain.model.legacy.RelationGroupLegacy import ac.dnd.bookkeeping.android.presentation.common.theme.Body1 import ac.dnd.bookkeeping.android.presentation.common.theme.Body2 import ac.dnd.bookkeeping.android.presentation.common.theme.Caption1 @@ -38,8 +38,8 @@ import java.text.DecimalFormat @Composable fun HistoryRelationItem( - relation: Relation, - onSelectCard: (Relation) -> Unit + relation: RelationLegacy, + onSelectCard: (RelationLegacy) -> Unit ) { Card( shape = Shapes.medium, @@ -145,10 +145,10 @@ fun HistoryRelationItem( @Composable fun HeartItemPreview() { HistoryRelationItem( - relation = Relation( + relation = RelationLegacy( id = 8446, name = "Harlan Yang", - group = RelationGroup( + group = RelationGroupLegacy( id = 2337, name = "Angelia McBride", ),