Skip to content

Commit

Permalink
[Feat/#88] DataSource, Repository, 구현체 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoncheong committed Jul 19, 2023
1 parent 8f5dfcd commit 297e58a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ package com.sopt.umbba_android.data.datasource

import com.sopt.umbba_android.data.model.ServicePool
import com.sopt.umbba_android.data.model.request.InviteCodeRequestDto
import com.sopt.umbba_android.data.model.request.ReceiveInfoRequestDto
import com.sopt.umbba_android.data.model.request.SendInfoRequestDto
import com.sopt.umbba_android.data.model.response.InviteCodeResponseDto
import com.sopt.umbba_android.data.model.response.ReceiveInfoResponseDto
import com.sopt.umbba_android.data.model.response.SendInfoResponseDto

class OnboardingRemoteDataSource {
private val onboardingService = ServicePool.onboardingService
suspend fun setFamily(onboardingRequestDto: InviteCodeRequestDto) : InviteCodeResponseDto =
onboardingService.setFamily(onboardingRequestDto)

suspend fun setSendInfo(sendInfoRequestDto: SendInfoRequestDto) : SendInfoResponseDto =
onboardingService.setSendInfo(sendInfoRequestDto)

suspend fun setReceiveInfo(receiveInfoRequestDto: ReceiveInfoRequestDto) : ReceiveInfoResponseDto =
onboardingService.setReceiveInfo(receiveInfoRequestDto)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package com.sopt.umbba_android.data.repository
import android.util.Log
import com.sopt.umbba_android.data.datasource.OnboardingRemoteDataSource
import com.sopt.umbba_android.data.model.request.InviteCodeRequestDto
import com.sopt.umbba_android.data.model.request.ReceiveInfoRequestDto
import com.sopt.umbba_android.data.model.request.SendInfoRequestDto
import com.sopt.umbba_android.data.model.response.InviteCodeResponseDto
import com.sopt.umbba_android.data.model.response.ReceiveInfoResponseDto
import com.sopt.umbba_android.data.model.response.SendInfoResponseDto
import com.sopt.umbba_android.domain.repository.OnboardingRepository

class OnboardingRepositoryImpl(
Expand All @@ -13,8 +17,26 @@ class OnboardingRepositoryImpl(
runCatching {
onboardingRemoteDataSource.setFamily(inviteCodeRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding Impl 성공")
Log.e("yeonjin", "onboarding setFamily Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding Impl 실패")
Log.e("yeonjin", "onboarding setFamily Impl 실패")
}

override suspend fun setSendInfo(sendInfoRequestDto: SendInfoRequestDto): Result<SendInfoResponseDto> =
runCatching {
onboardingRemoteDataSource.setSendInfo(sendInfoRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding setSendInfo Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding setSendInfo Impl 성공")
}

override suspend fun setReceiveInfo(receiveInfoRequestDto: ReceiveInfoRequestDto): Result<ReceiveInfoResponseDto> =
runCatching {
onboardingRemoteDataSource.setReceiveInfo(receiveInfoRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공")
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
package com.sopt.umbba_android.domain.repository

import com.sopt.umbba_android.data.model.request.InviteCodeRequestDto
import com.sopt.umbba_android.data.model.request.ReceiveInfoRequestDto
import com.sopt.umbba_android.data.model.request.SendInfoRequestDto
import com.sopt.umbba_android.data.model.response.InviteCodeResponseDto
import com.sopt.umbba_android.data.model.response.ReceiveInfoResponseDto
import com.sopt.umbba_android.data.model.response.SendInfoResponseDto

interface OnboardingRepository {
suspend fun setFamily(inviteCodeRequestDto: InviteCodeRequestDto): Result<InviteCodeResponseDto>

suspend fun setSendInfo(sendInfoRequestDto: SendInfoRequestDto): Result<SendInfoResponseDto>

suspend fun setReceiveInfo(receiveInfoRequestDto: ReceiveInfoRequestDto): Result<ReceiveInfoResponseDto>
}

0 comments on commit 297e58a

Please sign in to comment.