-
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 #86 from everymeals/feature/school_auth_screen
[Feature/school_auth_screen]: 학교 이메일 인증 작업
- Loading branch information
Showing
21 changed files
with
581 additions
and
14 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
7 changes: 7 additions & 0 deletions
7
data/src/main/java/com/everymeal/data/datasource/auth/AuthRemoteDataSource.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,7 @@ | ||
package com.everymeal.data.datasource.auth | ||
|
||
import com.everymeal.domain.model.auth.Email | ||
|
||
interface AuthRemoteDataSource { | ||
suspend fun postEmail(email: Email): Result<String> | ||
} |
16 changes: 16 additions & 0 deletions
16
data/src/main/java/com/everymeal/data/datasource/auth/AuthRemoteRemoteDataSourceImpl.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,16 @@ | ||
package com.everymeal.data.datasource.auth | ||
|
||
import com.everymeal.data.model.auth.toEmailRequest | ||
import com.everymeal.data.model.unwrapData | ||
import com.everymeal.data.service.auth.AuthApi | ||
import com.everymeal.domain.model.auth.Email | ||
import javax.inject.Inject | ||
|
||
class AuthRemoteRemoteDataSourceImpl @Inject constructor( | ||
private val authApi: AuthApi | ||
) : AuthRemoteDataSource { | ||
|
||
override suspend fun postEmail(email: Email): Result<String> = runCatching { | ||
authApi.postEmail(email.toEmailRequest()) | ||
}.unwrapData() | ||
} |
20 changes: 20 additions & 0 deletions
20
data/src/main/java/com/everymeal/data/model/auth/EmailRequest.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,20 @@ | ||
package com.everymeal.data.model.auth | ||
|
||
|
||
import com.everymeal.domain.model.auth.Email | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EmailRequest( | ||
@SerialName("email") | ||
val email: String? = null | ||
) | ||
|
||
fun EmailRequest.toEmail() = Email( | ||
email = email ?: "" | ||
) | ||
|
||
fun Email.toEmailRequest() = EmailRequest( | ||
email = email | ||
) |
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/everymeal/data/repository/DefaultAuthRepository.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,14 @@ | ||
package com.everymeal.data.repository | ||
|
||
import com.everymeal.data.datasource.auth.AuthRemoteDataSource | ||
import com.everymeal.domain.model.auth.Email | ||
import com.everymeal.domain.repository.auth.AuthRepository | ||
import javax.inject.Inject | ||
|
||
class DefaultAuthRepository @Inject constructor( | ||
private val authRemoteDataSource: AuthRemoteDataSource | ||
) : AuthRepository { | ||
override suspend fun postEmail(email: Email): Result<String> { | ||
return authRemoteDataSource.postEmail(email) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
data/src/main/java/com/everymeal/data/service/auth/AuthApi.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,10 @@ | ||
package com.everymeal.data.service.auth | ||
|
||
import com.everymeal.data.model.BaseResponse | ||
import com.everymeal.data.model.auth.EmailRequest | ||
import retrofit2.http.POST | ||
|
||
interface AuthApi { | ||
@POST("/api/v1/users/email") | ||
suspend fun postEmail(emailRequest: EmailRequest): BaseResponse<String> | ||
} |
5 changes: 5 additions & 0 deletions
5
domain/src/main/java/com/everymeal/domain/model/auth/Email.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,5 @@ | ||
package com.everymeal.domain.model.auth | ||
|
||
data class Email( | ||
val email: String | ||
) |
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/com/everymeal/domain/repository/auth/AuthRepository.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,8 @@ | ||
package com.everymeal.domain.repository.auth | ||
|
||
import com.everymeal.domain.model.auth.Email | ||
|
||
interface AuthRepository { | ||
suspend fun postEmail(email: Email): Result<String> | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
domain/src/main/java/com/everymeal/domain/usecase/auth/PostEmailUseCase.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.everymeal.domain.usecase.auth | ||
|
||
import com.everymeal.domain.model.auth.Email | ||
import com.everymeal.domain.repository.auth.AuthRepository | ||
import javax.inject.Inject | ||
|
||
class PostEmailUseCase @Inject constructor( | ||
private val authRepository: AuthRepository | ||
) { | ||
suspend operator fun invoke( | ||
email: Email | ||
): Result<String> { | ||
return authRepository.postEmail(email) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,4 +101,4 @@ fun MainScreen( | |
@Composable | ||
fun MainScreenPreview() { | ||
MainScreen() | ||
} | ||
} |
Oops, something went wrong.