diff --git a/data/src/main/java/com/going/data/dto/request/SignInRequestDto.kt b/data/src/main/java/com/going/data/dto/request/SignInRequestDto.kt index 26b60f39..bd982038 100644 --- a/data/src/main/java/com/going/data/dto/request/SignInRequestDto.kt +++ b/data/src/main/java/com/going/data/dto/request/SignInRequestDto.kt @@ -1,5 +1,7 @@ package com.going.data.dto.request +import com.going.domain.entity.request.RequestSignInModel +import com.going.domain.entity.request.RequestSignUpModel import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -8,3 +10,6 @@ data class SignInRequestDto( @SerialName("platform") val platform: String ) + +fun RequestSignInModel.toSignInRequestDto(): SignInRequestDto = + SignInRequestDto(platform) diff --git a/data/src/main/java/com/going/data/repositoryImpl/AuthRepositoryImpl.kt b/data/src/main/java/com/going/data/repositoryImpl/AuthRepositoryImpl.kt index 90d7a1b5..e4414b50 100644 --- a/data/src/main/java/com/going/data/repositoryImpl/AuthRepositoryImpl.kt +++ b/data/src/main/java/com/going/data/repositoryImpl/AuthRepositoryImpl.kt @@ -1,8 +1,9 @@ package com.going.data.repositoryImpl import com.going.data.datasource.AuthDataSource -import com.going.data.dto.request.SignInRequestDto +import com.going.data.dto.request.toSignInRequestDto import com.going.data.dto.request.toSignUpRequestDto +import com.going.domain.entity.request.RequestSignInModel import com.going.domain.entity.request.RequestSignUpModel import com.going.domain.entity.response.AuthTokenModel import com.going.domain.repository.AuthRepository @@ -13,12 +14,12 @@ class AuthRepositoryImpl @Inject constructor( ) : AuthRepository { override suspend fun postSignIn( Authorization: String, - platform: String, + data: RequestSignInModel, ): Result = runCatching { authDataSource.postLogin( Authorization, - SignInRequestDto(platform), + data.toSignInRequestDto(), ).data.toAuthTokenModel() } diff --git a/domain/src/main/kotlin/com/going/domain/entity/request/RequestSignInModel.kt b/domain/src/main/kotlin/com/going/domain/entity/request/RequestSignInModel.kt new file mode 100644 index 00000000..fc88c6ea --- /dev/null +++ b/domain/src/main/kotlin/com/going/domain/entity/request/RequestSignInModel.kt @@ -0,0 +1,5 @@ +package com.going.domain.entity.request + +data class RequestSignInModel( + val platform: String +) diff --git a/domain/src/main/kotlin/com/going/domain/repository/AuthRepository.kt b/domain/src/main/kotlin/com/going/domain/repository/AuthRepository.kt index 8625150a..1f4ebdd7 100644 --- a/domain/src/main/kotlin/com/going/domain/repository/AuthRepository.kt +++ b/domain/src/main/kotlin/com/going/domain/repository/AuthRepository.kt @@ -1,12 +1,13 @@ package com.going.domain.repository +import com.going.domain.entity.request.RequestSignInModel import com.going.domain.entity.request.RequestSignUpModel import com.going.domain.entity.response.AuthTokenModel interface AuthRepository { suspend fun postSignIn( Authorization: String, - platform: String, + data: RequestSignInModel, ): Result suspend fun postSignUp( diff --git a/presentation/src/main/java/com/going/presentation/onboarding/signin/SignInViewModel.kt b/presentation/src/main/java/com/going/presentation/onboarding/signin/SignInViewModel.kt index 0a48af62..d4b80f38 100644 --- a/presentation/src/main/java/com/going/presentation/onboarding/signin/SignInViewModel.kt +++ b/presentation/src/main/java/com/going/presentation/onboarding/signin/SignInViewModel.kt @@ -3,6 +3,7 @@ package com.going.presentation.onboarding.signin import android.content.Context import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.going.domain.entity.request.RequestSignInModel import com.going.domain.repository.AuthRepository import com.going.domain.repository.TokenRepository import com.going.presentation.util.toErrorCode @@ -65,12 +66,12 @@ class SignInViewModel @Inject constructor( // 서버통신 - 카카오 토큰 보내서 서비스 토큰 받아오기 - 서버와 협의 후 수정예정 private fun changeTokenFromServer( accessToken: String, - social: String = KAKAO, + platform: String = KAKAO, ) { _postChangeTokenState.value = SignInState.LOADING viewModelScope.launch { - authRepository.postSignIn(accessToken, social).onSuccess { + authRepository.postSignIn(accessToken, RequestSignInModel(platform)).onSuccess { tokenRepository.setTokens(it.accessToken, it.refreshToken) _postChangeTokenState.value = SignInState.SUCCESS