File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed
api/src/main/kotlin/com/ninecraft/booket/core/data/api/repository
impl/src/main/kotlin/com/ninecraft/booket/core/data/impl
model/src/main/kotlin/com/ninecraft/booket/core/model Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 11package com.ninecraft.booket.core.data.api.repository
22
33import com.ninecraft.booket.core.model.OnboardingState
4+ import com.ninecraft.booket.core.model.TermsAgreementModel
45import com.ninecraft.booket.core.model.UserProfileModel
56import kotlinx.coroutines.flow.Flow
67
78interface UserRepository {
8- suspend fun agreeTerms (termsAgreed : Boolean ): Result <Unit >
9+ suspend fun agreeTerms (termsAgreed : Boolean ): Result <TermsAgreementModel >
910
1011 suspend fun getUserProfile (): Result <UserProfileModel >
1112
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import com.ninecraft.booket.core.model.RecentBookModel
1919import com.ninecraft.booket.core.model.RecordDetailModel
2020import com.ninecraft.booket.core.model.RecordRegisterModel
2121import com.ninecraft.booket.core.model.SeedModel
22+ import com.ninecraft.booket.core.model.TermsAgreementModel
2223import com.ninecraft.booket.core.model.UserProfileModel
2324import com.ninecraft.booket.core.network.response.BookDetailResponse
2425import com.ninecraft.booket.core.network.response.BookSearchResponse
@@ -36,6 +37,7 @@ import com.ninecraft.booket.core.network.response.RecentBook
3637import com.ninecraft.booket.core.network.response.RecordDetailResponse
3738import com.ninecraft.booket.core.network.response.RecordRegisterResponse
3839import com.ninecraft.booket.core.network.response.SeedResponse
40+ import com.ninecraft.booket.core.network.response.TermsAgreementResponse
3941import com.ninecraft.booket.core.network.response.UserProfileResponse
4042
4143internal fun UserProfileResponse.toModel (): UserProfileModel {
@@ -236,3 +238,13 @@ internal fun Category.toEmotionModel(): EmotionModel? {
236238 count = count,
237239 )
238240}
241+
242+ internal fun TermsAgreementResponse.toModel (): TermsAgreementModel {
243+ return TermsAgreementModel (
244+ id = id,
245+ email = email,
246+ nickname = nickname,
247+ provider = provider,
248+ termsAgreed = termsAgreed,
249+ )
250+ }
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ internal class DefaultUserRepository @Inject constructor(
1313 private val onboardingDataSource : OnboardingDataSource ,
1414) : UserRepository {
1515 override suspend fun agreeTerms (termsAgreed : Boolean ) = runSuspendCatching {
16- service.agreeTerms(TermsAgreementRequest (termsAgreed))
17- Unit
16+ service.agreeTerms(TermsAgreementRequest (termsAgreed)).toModel()
1817 }
1918
2019 override suspend fun getUserProfile () = runSuspendCatching {
Original file line number Diff line number Diff line change 1+ package com.ninecraft.booket.core.model
2+
3+ data class TermsAgreementModel (
4+ val id : String ,
5+ val email : String ,
6+ val nickname : String ,
7+ val provider : String ,
8+ val termsAgreed : Boolean ,
9+ )
You can’t perform that action at this time.
0 commit comments