generated from ajou4095/template-android
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
249 additions
and
42 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
14 changes: 14 additions & 0 deletions
14
...in/kotlin/ac/dnd/bookkeeping/android/data/remote/network/model/authentication/LoginReq.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 ac.dnd.bookkeeping.android.data.remote.network.model.authentication | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class LoginReq( | ||
@SerialName("socialId") | ||
val socialId: String, | ||
@SerialName("email") | ||
val email: String, | ||
@SerialName("profileImageUrl") | ||
val profileImageUrl: String | ||
) |
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
6 changes: 6 additions & 0 deletions
6
domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/JwtToken.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,6 @@ | ||
package ac.dnd.bookkeeping.android.domain.model.authentication | ||
|
||
data class JwtToken( | ||
val accessToken: String, | ||
val refreshToken: String | ||
) |
5 changes: 5 additions & 0 deletions
5
domain/src/main/kotlin/ac/dnd/bookkeeping/android/domain/model/authentication/Login.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 ac.dnd.bookkeeping.android.domain.model.authentication | ||
|
||
data class Login( | ||
val isNew: Boolean | ||
) |
17 changes: 15 additions & 2 deletions
17
.../src/main/kotlin/ac/dnd/bookkeeping/android/domain/repository/AuthenticationRepository.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 |
---|---|---|
@@ -1,12 +1,25 @@ | ||
package ac.dnd.bookkeeping.android.domain.repository | ||
|
||
import ac.dnd.bookkeeping.android.domain.model.authentication.JwtToken | ||
import ac.dnd.bookkeeping.android.domain.model.authentication.Login | ||
|
||
interface AuthenticationRepository { | ||
|
||
var refreshToken: String | ||
|
||
var accessToken: String | ||
|
||
suspend fun getAccessToken( | ||
suspend fun refreshToken( | ||
refreshToken: String | ||
): Result<String> | ||
): Result<JwtToken> | ||
|
||
suspend fun login( | ||
socialId: String, | ||
email: String, | ||
profileImageUrl: String | ||
): Result<Login> | ||
|
||
suspend fun logout(): Result<Unit> | ||
|
||
suspend fun withdraw(): Result<Unit> | ||
} |
21 changes: 21 additions & 0 deletions
21
.../src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LoginUseCase.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 ac.dnd.bookkeeping.android.domain.usecase.authentication | ||
|
||
import ac.dnd.bookkeeping.android.domain.model.authentication.Login | ||
import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository | ||
import javax.inject.Inject | ||
|
||
class LoginUseCase @Inject constructor( | ||
private val authenticationRepository: AuthenticationRepository | ||
) { | ||
suspend operator fun invoke( | ||
socialId: String, | ||
email: String, | ||
profileImageUrl: String | ||
): Result<Login> { | ||
return authenticationRepository.login( | ||
socialId = socialId, | ||
email = email, | ||
profileImageUrl = profileImageUrl | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...src/main/kotlin/ac/dnd/bookkeeping/android/domain/usecase/authentication/LogoutUseCase.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 ac.dnd.bookkeeping.android.domain.usecase.authentication | ||
|
||
import ac.dnd.bookkeeping.android.domain.model.authentication.Login | ||
import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository | ||
import javax.inject.Inject | ||
|
||
class LogoutUseCase @Inject constructor( | ||
private val authenticationRepository: AuthenticationRepository | ||
) { | ||
suspend operator fun invoke( | ||
socialId: String, | ||
email: String, | ||
profileImageUrl: String | ||
): Result<Login> { | ||
return authenticationRepository.login( | ||
socialId = socialId, | ||
email = email, | ||
profileImageUrl = profileImageUrl | ||
) | ||
} | ||
} |
Oops, something went wrong.