Skip to content

Commit

Permalink
rename/#9: 기본 응답 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
boiledEgg-s committed Nov 4, 2024
1 parent 1f2743f commit ff8151f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.sopt.and.data.datasource

import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.request.SignUpRequest
import org.sopt.and.data.dto.response.SignUpResponseDto
import retrofit2.Call

interface UserDataSource {
fun postSignUp(
request: SignUpRequest
): Call<BaseSuccessResponse<SignUpResponseDto>>
): Call<BaseResponse<SignUpResponseDto>>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.sopt.and.data.datasourceImpl

import org.sopt.and.data.datasource.UserDataSource
import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.request.SignUpRequest
import org.sopt.and.data.dto.response.SignUpResponseDto
import org.sopt.and.data.remote.UserService
Expand All @@ -11,5 +11,5 @@ import javax.inject.Inject
class UserDataSourceImpl @Inject constructor(
private val userService: UserService
): UserDataSource {
override fun postSignUp(request: SignUpRequest): Call<BaseSuccessResponse<SignUpResponseDto>> = userService.signUp(request)
override fun postSignUp(request: SignUpRequest): Call<BaseResponse<SignUpResponseDto>> = userService.signUp(request)
}
10 changes: 0 additions & 10 deletions app/src/main/java/org/sopt/and/data/dto/BaseFailureResponse.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class BaseSuccessResponse<T>(
data class BaseResponse<T>(
@SerialName("result")
val result: T
)
4 changes: 2 additions & 2 deletions app/src/main/java/org/sopt/and/data/remote/UserService.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.sopt.and.data.remote

import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.request.SignUpRequest
import org.sopt.and.data.dto.response.SignUpResponseDto
import retrofit2.Call
Expand All @@ -11,5 +11,5 @@ interface UserService {
@POST("/user")
fun signUp(
@Body request: SignUpRequest
): Call<BaseSuccessResponse<SignUpResponseDto>>
): Call<BaseResponse<SignUpResponseDto>>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.sopt.and.data.repositoryimpl

import org.sopt.and.data.datasource.UserDataSource
import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.response.SignUpResponseDto
import org.sopt.and.data.mapper.toSignUpRequest
import org.sopt.and.domain.entity.User
Expand All @@ -12,6 +12,6 @@ import javax.inject.Inject
class SignUpRepositoryImpl @Inject constructor(
private val userDataSource: UserDataSource
): SignUpRepository {
override fun registerUser(user: User): Call<BaseSuccessResponse<SignUpResponseDto>> = userDataSource.postSignUp(user.toSignUpRequest())
override fun registerUser(user: User): Call<BaseResponse<SignUpResponseDto>> = userDataSource.postSignUp(user.toSignUpRequest())

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.sopt.and.domain.repository

import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.response.SignUpResponseDto
import org.sopt.and.domain.entity.User
import retrofit2.Call

interface SignUpRepository {
fun registerUser(user: User): Call<BaseSuccessResponse<SignUpResponseDto>>
fun registerUser(user: User): Call<BaseResponse<SignUpResponseDto>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import org.sopt.and.R
import org.sopt.and.core.designsystem.component.SocialAccountGroup
import org.sopt.and.core.designsystem.component.text.BulletAnnotedText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.json.JSONObject
import org.sopt.and.R
import org.sopt.and.data.dto.BaseSuccessResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.response.SignUpResponseDto
import org.sopt.and.domain.entity.User
import org.sopt.and.domain.repository.SignUpRepository
Expand Down Expand Up @@ -55,10 +55,10 @@ class SignUpViewModel @Inject constructor(
fun registerUser() {
val user = with(_uiState.value) { User(id, password, "hobby") }
signUpRepository.registerUser(user)
.enqueue(object : Callback<BaseSuccessResponse<SignUpResponseDto>> {
.enqueue(object : Callback<BaseResponse<SignUpResponseDto>> {
override fun onResponse(
call: Call<BaseSuccessResponse<SignUpResponseDto>>,
response: Response<BaseSuccessResponse<SignUpResponseDto>>
call: Call<BaseResponse<SignUpResponseDto>>,
response: Response<BaseResponse<SignUpResponseDto>>
) {
if (response.isSuccessful) {
val body = response.body()
Expand All @@ -79,7 +79,7 @@ class SignUpViewModel @Inject constructor(
}
}
override fun onFailure(
call: Call<BaseSuccessResponse<SignUpResponseDto>>,
call: Call<BaseResponse<SignUpResponseDto>>,
response: Throwable
) {
Log.d("error", response.toString())
Expand Down

0 comments on commit ff8151f

Please sign in to comment.