-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from meongmory/feature/login_phone
[feature/login_phone] 인증번호 화면 구현 및 api 연결
- Loading branch information
Showing
34 changed files
with
610 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
data/src/main/java/com/meongmoryteam/data/datasource/FoodDataSource.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
data/src/main/java/com/meongmoryteam/data/datasource/FoodDataSourceImpl.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
data/src/main/java/com/meongmoryteam/data/datasource/login/LoginDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.meongmoryteam.data.datasource.login | ||
|
||
import com.meongmoryteam.data.model.response.login.GetSmsSendResponse | ||
import com.meongmoryteam.data.model.request.login.SmsSendRequest | ||
import com.meongmoryteam.data.model.request.login.SmsValidateRequest | ||
import com.meongmoryteam.data.model.response.login.PostSmsValidateResponse | ||
|
||
interface LoginDataSource { | ||
suspend fun getSmsSend(smsSendRequest: SmsSendRequest): Result<GetSmsSendResponse> | ||
suspend fun postSmsValidate(smsValidateRequest: SmsValidateRequest): Result<PostSmsValidateResponse> | ||
} |
21 changes: 21 additions & 0 deletions
21
data/src/main/java/com/meongmoryteam/data/datasource/login/LoginDataSourceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.meongmoryteam.data.datasource.login | ||
|
||
import com.meongmoryteam.data.model.response.login.GetSmsSendResponse | ||
import com.meongmoryteam.data.model.request.login.SmsSendRequest | ||
import com.meongmoryteam.data.model.request.login.SmsValidateRequest | ||
import com.meongmoryteam.data.model.response.login.PostSmsValidateResponse | ||
import com.meongmoryteam.data.service.login.LoginApi | ||
import javax.inject.Inject | ||
|
||
class LoginDataSourceImpl @Inject constructor( | ||
private val loginApi: LoginApi | ||
): LoginDataSource { | ||
|
||
override suspend fun getSmsSend(smsSendRequest: SmsSendRequest): Result<GetSmsSendResponse> { | ||
return runCatching { loginApi.getSmsSend(smsSendRequest) } | ||
} | ||
|
||
override suspend fun postSmsValidate(smsValidateRequest: SmsValidateRequest): Result<PostSmsValidateResponse> { | ||
return runCatching { loginApi.postSmsValidate(smsValidateRequest) } | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
data/src/main/java/com/meongmoryteam/data/model/GetWeekFood.kt
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
data/src/main/java/com/meongmoryteam/data/model/request/login/SmsSendRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.meongmoryteam.data.model.request.login | ||
|
||
import com.meongmoryteam.domain.model.reqeust.login.SmsSendRequestEntity | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SmsSendRequest( | ||
val phone: String | ||
) | ||
|
||
fun SmsSendRequestEntity.toSmsSendRequest(): SmsSendRequest { | ||
return SmsSendRequest( | ||
phone = this.phone | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
data/src/main/java/com/meongmoryteam/data/model/request/login/SmsValidateRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.meongmoryteam.data.model.request.login | ||
|
||
import com.meongmoryteam.domain.model.reqeust.login.SmsValidateRequestEntity | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SmsValidateRequest( | ||
val code: String, | ||
val phone: String | ||
) | ||
|
||
fun SmsValidateRequestEntity.toSmsValidateRequest(): SmsValidateRequest { | ||
return SmsValidateRequest( | ||
code = this.code, | ||
phone = this.phone | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
data/src/main/java/com/meongmoryteam/data/model/response/login/GetSmsSendResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.meongmoryteam.data.model.response.login | ||
|
||
import com.meongmoryteam.domain.model.response.login.GetSmsSendData | ||
import com.meongmoryteam.domain.model.response.login.GetSmsSendEntity | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class GetSmsSendResponse( | ||
val status: Int, | ||
val code: String, | ||
val message: String, | ||
val data: Data, | ||
) | ||
|
||
@Serializable | ||
data class Data( | ||
val value: String, | ||
val message: String? | ||
) | ||
|
||
fun GetSmsSendResponse.toGetSmsSendEntity(): GetSmsSendEntity { | ||
return GetSmsSendEntity( | ||
status = this.status, | ||
code = this.code, | ||
message = this.message, | ||
getSmsSendData = GetSmsSendData( | ||
value = this.data.value, | ||
message = this.data.message | ||
) | ||
) | ||
} |
21 changes: 21 additions & 0 deletions
21
data/src/main/java/com/meongmoryteam/data/model/response/login/PostSmsValidateResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.meongmoryteam.data.model.response.login | ||
|
||
import com.meongmoryteam.domain.model.response.login.PostSmsValidateEntity | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PostSmsValidateResponse( | ||
val status: Int, | ||
val code: String, | ||
val message: String, | ||
val data: Boolean | ||
) | ||
|
||
fun PostSmsValidateResponse.toPostSmsValidateEntity(): PostSmsValidateEntity { | ||
return PostSmsValidateEntity( | ||
status = this.status, | ||
code = this.code, | ||
message = this.message, | ||
data = this.data | ||
) | ||
} |
16 changes: 0 additions & 16 deletions
16
data/src/main/java/com/meongmoryteam/data/repository/FoodRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
data/src/main/java/com/meongmoryteam/data/repository/login/LoginRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.meongmoryteam.data.repository.login | ||
|
||
import com.meongmoryteam.data.datasource.login.LoginDataSource | ||
import com.meongmoryteam.data.model.response.login.toGetSmsSendEntity | ||
import com.meongmoryteam.data.model.request.login.toSmsSendRequest | ||
import com.meongmoryteam.data.model.request.login.toSmsValidateRequest | ||
import com.meongmoryteam.data.model.response.login.toPostSmsValidateEntity | ||
import com.meongmoryteam.domain.model.response.login.GetSmsSendEntity | ||
import com.meongmoryteam.domain.model.reqeust.login.SmsSendRequestEntity | ||
import com.meongmoryteam.domain.model.reqeust.login.SmsValidateRequestEntity | ||
import com.meongmoryteam.domain.model.response.login.PostSmsValidateEntity | ||
import com.meongmoryteam.domain.repository.login.LoginRepository | ||
import javax.inject.Inject | ||
|
||
class LoginRepositoryImpl @Inject constructor( | ||
private val loginDataSource: LoginDataSource | ||
) : LoginRepository { | ||
|
||
override suspend fun getSmsSend(smsSendRequestEntity: SmsSendRequestEntity): Result<GetSmsSendEntity> { | ||
return loginDataSource.getSmsSend(smsSendRequestEntity.toSmsSendRequest()).map { it.toGetSmsSendEntity() } | ||
} | ||
|
||
override suspend fun postSmsValidate(smsValidateRequestEntity: SmsValidateRequestEntity): Result<PostSmsValidateEntity> { | ||
return loginDataSource.postSmsValidate(smsValidateRequestEntity.toSmsValidateRequest()).map { it.toPostSmsValidateEntity() } | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
data/src/main/java/com/meongmoryteam/data/service/ExampleApi.kt
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
data/src/main/java/com/meongmoryteam/data/service/login/LoginApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.meongmoryteam.data.service.login | ||
|
||
import com.meongmoryteam.data.model.response.login.GetSmsSendResponse | ||
import com.meongmoryteam.data.model.request.login.SmsSendRequest | ||
import com.meongmoryteam.data.model.request.login.SmsValidateRequest | ||
import com.meongmoryteam.data.model.response.login.PostSmsValidateResponse | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface LoginApi { | ||
|
||
@POST("sms/send") | ||
suspend fun getSmsSend( | ||
@Body smsSendRequest: SmsSendRequest | ||
): GetSmsSendResponse | ||
|
||
@POST("sms/validate") | ||
suspend fun postSmsValidate( | ||
@Body smsValidateRequest: SmsValidateRequest | ||
): PostSmsValidateResponse | ||
} |
18 changes: 0 additions & 18 deletions
18
domain/src/main/java/com/meongmoryteam/domain/model/ResponseWeekFoodEntity.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.