Skip to content

Commit

Permalink
chore/#8: request, response 파일명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyein9892 committed Nov 15, 2024
1 parent d4b7e5e commit fe87207
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.sopt.and.data.di.UserSharedPreference
import org.sopt.and.data.dto.request.SignUpRequest
import org.sopt.and.data.service.UserService
import org.sopt.and.domain.exception.Result
import org.sopt.and.domain.model.SignUp
import org.sopt.and.domain.model.SignUpRequest

internal class UserDataSource @Inject constructor(
@UserSharedPreference private val userSharedPreference: SharedPreferences,
Expand All @@ -28,7 +28,7 @@ internal class UserDataSource @Inject constructor(
userSharedPreference.edit().clear().apply()
}

suspend fun signUp(request: SignUpRequest): Result<SignUp> = execute {
suspend fun signUp(request: SignUpRequest): Result<org.sopt.and.domain.model.SignUpRequest> = execute {
userService.signUp(request).result.toDomainModel()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sopt.and.data.dto.response
package org.sopt.and.data.dto

import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import kotlinx.serialization.Serializable
import org.sopt.and.domain.model.User

@Serializable
data class SignUpRequest(
internal data class SignUpRequest(
val hobby: String,
val password: String,
val username: String
)

fun User.toRequestBody(): SignUpRequest {
internal fun User.toRequestBody(): SignUpRequest {
return SignUpRequest(
hobby = hobby,
password = password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package org.sopt.and.data.dto.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.sopt.and.domain.model.SignUp
import org.sopt.and.domain.model.SignUpRequest

@Serializable
internal data class SignUpResponse(
internal data class SignUpResponseDto(
@SerialName("no")
val userNumber: Int
){
fun toDomainModel(): SignUp {
return SignUp(
fun toDomainModel(): SignUpRequest {
return SignUpRequest(
userNumber = userNumber
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.sopt.and.data.repository
import jakarta.inject.Inject
import org.sopt.and.data.datasource.UserDataSource
import org.sopt.and.data.dto.request.toRequestBody
import org.sopt.and.domain.model.SignUp
import org.sopt.and.domain.model.SignUpRequest
import org.sopt.and.domain.model.User
import org.sopt.and.domain.repository.UserRepository
import org.sopt.and.domain.exception.Result
Expand All @@ -24,7 +24,7 @@ internal class UserRepositoryImpl @Inject constructor(
return userDataSource.id
}

override suspend fun signUp(user: User): Result<SignUp> {
override suspend fun signUp(user: User): Result<SignUpRequest> {
return userDataSource.signUp(user.toRequestBody())
}

Expand Down
6 changes: 3 additions & 3 deletions data/src/main/java/org/sopt/and/data/service/UserService.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.sopt.and.data.service

import org.sopt.and.data.dto.request.SignUpRequest
import org.sopt.and.data.dto.response.BaseResponse
import org.sopt.and.data.dto.response.SignUpResponse
import org.sopt.and.data.dto.BaseResponse
import org.sopt.and.data.dto.response.SignUpResponseDto
import retrofit2.http.Body
import retrofit2.http.POST

internal interface UserService {
@POST("user")
suspend fun signUp(
@Body request: SignUpRequest
): BaseResponse<SignUpResponse>
): BaseResponse<SignUpResponseDto>

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

data class SignUp(
data class SignUpRequest(
val userNumber: Int
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.sopt.and.domain.repository

import org.sopt.and.domain.model.SignUp
import org.sopt.and.domain.model.SignUpRequest
import org.sopt.and.domain.model.User
import org.sopt.and.domain.exception.Result

interface UserRepository {
fun saveUser(id: String, password: String)
fun clearIdPassword()
fun getId(): String
suspend fun signUp(user: User): Result<SignUp>
suspend fun signUp(user: User): Result<SignUpRequest>
}

0 comments on commit fe87207

Please sign in to comment.