generated from AND-SOPT-ANDROID/and-sopt-android-template
-
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.
- Loading branch information
Showing
17 changed files
with
174 additions
and
16 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
app/src/main/java/org/sopt/and/api/Api.kt → ...rc/main/java/org/sopt/and/data/api/Api.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
10 changes: 5 additions & 5 deletions
10
app/src/main/java/org/sopt/and/api/Auth.kt → ...c/main/java/org/sopt/and/data/api/Auth.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
4 changes: 2 additions & 2 deletions
4
app/src/main/java/org/sopt/and/api/Hobby.kt → .../main/java/org/sopt/and/data/api/Hobby.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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/org/sopt/and/data/datasource/MyHobbyDataSource.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 org.sopt.and.data.datasource | ||
|
||
import org.sopt.and.data.model.response.MyHobbyResponseDto | ||
import org.sopt.and.data.service.UserService | ||
|
||
class MyHobbyDataSource( | ||
private val userService: UserService | ||
) { | ||
suspend fun getMyHobby(): MyHobbyResponseDto = userService.getMyHobby() | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/sopt/and/data/datasource/SignInDataSource.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,13 @@ | ||
package org.sopt.and.data.datasource | ||
|
||
import org.sopt.and.data.model.request.SignInRequestDto | ||
import org.sopt.and.data.model.response.SignInResponseDto | ||
import org.sopt.and.data.service.UserService | ||
import retrofit2.Response | ||
|
||
class SignInDataSource( | ||
private val userService: UserService | ||
) { | ||
suspend fun signIn(request: SignInRequestDto): Response<SignInResponseDto> = | ||
userService.signIn(request = request) | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/sopt/and/data/datasource/SignUpDataSource.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,13 @@ | ||
package org.sopt.and.data.datasource | ||
|
||
import org.sopt.and.data.model.request.SignUpRequestDto | ||
import org.sopt.and.data.model.response.SignUpResponseDto | ||
import org.sopt.and.data.service.UserService | ||
import retrofit2.Response | ||
|
||
class SignUpDataSource( | ||
private val userService: UserService | ||
) { | ||
suspend fun signUp(request: SignUpRequestDto): Response<SignUpResponseDto> = | ||
userService.signUp(request = request) | ||
} |
2 changes: 1 addition & 1 deletion
2
app/src/main/java/org/sopt/and/dto/Auth.kt → ...c/main/java/org/sopt/and/data/dto/Auth.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
2 changes: 1 addition & 1 deletion
2
app/src/main/java/org/sopt/and/dto/My.kt → ...src/main/java/org/sopt/and/data/dto/My.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,4 +1,4 @@ | ||
package org.sopt.and.dto | ||
package org.sopt.and.data.api.dto | ||
|
||
|
||
import kotlinx.serialization.SerialName | ||
|
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/sopt/and/data/model/request/SignInRequestDto.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.and.data.model.request | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignInRequestDto( | ||
val username: String, | ||
val password: String | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/org/sopt/and/data/model/request/SignUpRequestDto.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 org.sopt.and.data.model.request | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignUpRequestDto( | ||
val username: String, | ||
val password: String, | ||
val hobby: String | ||
) |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/sopt/and/data/model/response/MyHobbyResponseDto.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 org.sopt.and.data.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class MyHobbyResponseDto( | ||
val result: MyHobbyResponseResultDto? = null, | ||
val code: String? = null | ||
) | ||
|
||
@Serializable | ||
data class MyHobbyResponseResultDto( | ||
@SerialName("hobby") | ||
val myHobby: String | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/sopt/and/data/model/response/SignInResponseDto.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 org.sopt.and.data.model.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignInResponseDto( | ||
val result: SignInResponseResultDto? = null, | ||
val code: String? = null | ||
) | ||
|
||
@Serializable | ||
data class SignInResponseResultDto( | ||
val token: String | ||
) |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/sopt/and/data/model/response/SignUpReponseDto.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 org.sopt.and.data.model.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignUpResponseDto( | ||
val result: SignUpResponseResultDto? = null, | ||
val code: String? = null | ||
) | ||
|
||
@Serializable | ||
data class SignUpResponseResultDto( | ||
val no: Int | ||
) |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/sopt/and/data/repositoryimpl/MyHobbyRepositoryImpl.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.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.GetMyHobbyDataSource | ||
import org.sopt.and.data.mapper.Mapper | ||
import org.sopt.and.domain.model.MyHobbyEntity | ||
import org.sopt.and.domain.repository.GetMyHobbyRepository | ||
|
||
class MyHobbyRepositoryImpl( | ||
private val getMyHobbyDataSource: GetMyHobbyDataSource | ||
) : GetMyHobbyRepository { | ||
override suspend fun getMyHobby(): Result<MyHobbyEntity> = | ||
runCatching { | ||
getMyHobbyDataSource.getMyHobby().result?.let { Mapper.toMyHobbyEntity(it) }!! | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/org/sopt/and/data/repositoryimpl/SignInRepositoryImpl.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,22 @@ | ||
package org.sopt.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.SignInDataSource | ||
import org.sopt.and.data.mapper.Mapper | ||
import org.sopt.and.domain.model.SignInInformationEntity | ||
import org.sopt.and.domain.model.SignInResponseEntity | ||
import org.sopt.and.domain.repository.SignInRepository | ||
|
||
class SignInRepositoryImpl( | ||
private val signInDataSource: SignInDataSource | ||
) : SignInRepository { | ||
override suspend fun signIn(request: SignInInformationEntity): Result<SignInResponseEntity> = | ||
runCatching { | ||
Mapper.toSignInResponseEntity( | ||
signInDataSource.signIn( | ||
Mapper.toSignInRequestDto( | ||
request | ||
) | ||
) | ||
)!! | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/org/sopt/and/data/repositoryimpl/SignUpRepositoryImpl.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,22 @@ | ||
package org.sopt.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.SignUpDataSource | ||
import org.sopt.and.data.mapper.Mapper | ||
import org.sopt.and.domain.model.SignUpInformationEntity | ||
import org.sopt.and.domain.model.SignUpResponseEntity | ||
import org.sopt.and.domain.repository.SignUpRepository | ||
|
||
class SignUpRepositoryImpl( | ||
private val signUpDataSource: SignUpDataSource | ||
) : SignUpRepository { | ||
override suspend fun signUp(request: SignUpInformationEntity): Result<SignUpResponseEntity> = | ||
runCatching { | ||
Mapper.toSignUpResponseEntity( | ||
signUpDataSource.signUp( | ||
Mapper.toSignUpRequestDto( | ||
request | ||
) | ||
) | ||
)!! | ||
} | ||
} |
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