generated from DO-SOPT-ANDROID/do-sopt-android-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] : AuthDomainRepository 생성, AuthDataSourceImpl 생성
- Loading branch information
Showing
4 changed files
with
55 additions
and
17 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/sopt/dosopttemplate/data/datasourceimpl/remote/AuthDataSourceImpl.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 org.sopt.dosopttemplate.data.datasourceimpl.remote | ||
|
||
import org.sopt.dosopttemplate.data.datasource.remote.AuthDataSource | ||
import org.sopt.dosopttemplate.data.dto.remote.request.RequestLoginDto | ||
import org.sopt.dosopttemplate.data.dto.remote.request.RequestSignUpDto | ||
import org.sopt.dosopttemplate.data.dto.remote.respose.ResponseLoginDto | ||
import org.sopt.dosopttemplate.data.service.AuthService | ||
|
||
class AuthDataSourceImpl(private val authService: AuthService) : AuthDataSource { | ||
override suspend fun login(request: RequestLoginDto): ResponseLoginDto = | ||
authService.postLogin(request) | ||
|
||
override suspend fun signUp(request: RequestSignUpDto): Unit = | ||
authService.postSignUp(request) | ||
} |
17 changes: 0 additions & 17 deletions
17
app/src/main/java/org/sopt/dosopttemplate/data/repositoryimpl/AuthRepository.kt
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
app/src/main/java/org/sopt/dosopttemplate/data/repositoryimpl/AuthRepositoryImpl.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 org.sopt.dosopttemplate.data.repositoryimpl | ||
|
||
import org.sopt.dosopttemplate.data.datasource.remote.AuthDataSource | ||
import org.sopt.dosopttemplate.data.dto.remote.request.RequestLoginDto | ||
import org.sopt.dosopttemplate.data.dto.remote.request.RequestSignUpDto | ||
import org.sopt.dosopttemplate.domain.entity.UserEntity | ||
import org.sopt.dosopttemplate.domain.entity.UserRequestEntity | ||
import org.sopt.dosopttemplate.domain.repository.AuthDomainRepository | ||
|
||
class AuthRepositoryImpl(private val authDataSource: AuthDataSource) : AuthDomainRepository { | ||
override suspend fun login(userRequestEntity: UserRequestEntity): Result<UserEntity> = | ||
kotlin.runCatching { | ||
authDataSource.login( | ||
RequestLoginDto( | ||
userRequestEntity.userName, | ||
userRequestEntity.passWord, | ||
), | ||
).toUserEntity() | ||
} | ||
|
||
override suspend fun signUp(userEntity: UserEntity): Result<Unit> = | ||
kotlin.runCatching { | ||
authDataSource.signUp( | ||
RequestSignUpDto( | ||
userEntity.id, | ||
userEntity.pwd, | ||
userEntity.nickName, | ||
), | ||
) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/sopt/dosopttemplate/domain/repository/AuthDomainRepository.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,9 @@ | ||
package org.sopt.dosopttemplate.domain.repository | ||
|
||
import org.sopt.dosopttemplate.domain.entity.UserEntity | ||
import org.sopt.dosopttemplate.domain.entity.UserRequestEntity | ||
|
||
interface AuthDomainRepository { | ||
suspend fun login(userRequestEntity: UserRequestEntity): Result<UserEntity> | ||
suspend fun signUp(userEntity: UserEntity): Result<Unit> | ||
} |