-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Week6] 6주차 필수 과제 #14
base: develop
Are you sure you want to change the base?
Changes from all commits
0ebb8fc
f512b35
1248207
0f51c4f
0a6499f
13738ee
e8cc88b
e4170ab
833364c
8383bee
094db33
fdf4887
7cb7dc7
f228e2f
a7ba597
859d8e8
ad24c45
0ca0bed
0b0d469
bcba10b
9f0cd0e
66fa970
92f4d78
2bf2804
ce45e9e
374274f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.sopt.and.core.navigation | ||
|
||
interface MainTabRoute : Route |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.sopt.and.core.navigation | ||
|
||
interface Route |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,10 @@ package org.sopt.and.data.datasource | |
import org.sopt.and.data.dto.request.RequestSignInDto | ||
import org.sopt.and.data.dto.request.RequestSignUpDto | ||
import org.sopt.and.data.dto.response.BaseResponse | ||
import org.sopt.and.data.dto.response.ResponseUserHobbyDto | ||
import org.sopt.and.data.dto.response.ResponseSignInDto | ||
import org.sopt.and.data.dto.response.ResponseSignUpDto | ||
|
||
interface WavveDataSource { | ||
interface AuthDataSource { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. datasource를 이렇게 유형별로 나누는게 좋은 방법이군요! |
||
suspend fun postSignUp(requestSignUpDto: RequestSignUpDto): BaseResponse<ResponseSignUpDto> | ||
suspend fun postSignIn(requestSignInDto: RequestSignInDto): BaseResponse<ResponseSignInDto> | ||
suspend fun getUserHobby(): BaseResponse<ResponseUserHobbyDto> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.sopt.and.data.datasource | ||
|
||
import org.sopt.and.data.dto.response.BaseResponse | ||
import org.sopt.and.data.dto.response.ResponseUserHobbyDto | ||
|
||
interface MyDataSource { | ||
suspend fun getUserHobby(): BaseResponse<ResponseUserHobbyDto> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
package org.sopt.and.data.datasourceimpl | ||
|
||
import org.sopt.and.data.datasource.WavveDataSource | ||
import org.sopt.and.data.datasource.AuthDataSource | ||
import org.sopt.and.data.dto.request.RequestSignInDto | ||
import org.sopt.and.data.dto.request.RequestSignUpDto | ||
import org.sopt.and.data.dto.response.BaseResponse | ||
import org.sopt.and.data.dto.response.ResponseUserHobbyDto | ||
import org.sopt.and.data.dto.response.ResponseSignInDto | ||
import org.sopt.and.data.dto.response.ResponseSignUpDto | ||
import org.sopt.and.data.service.WavveService | ||
import org.sopt.and.data.service.AuthService | ||
import javax.inject.Inject | ||
|
||
class WavveDataSourceImpl @Inject constructor( | ||
private val wavveService: WavveService | ||
) : WavveDataSource { | ||
class AuthDataSourceImpl @Inject constructor( | ||
private val authService: AuthService | ||
) : AuthDataSource { | ||
override suspend fun postSignUp(requestSignUpDto: RequestSignUpDto): BaseResponse<ResponseSignUpDto> = | ||
wavveService.postSignUp(requestSignUpDto) | ||
authService.postSignUp(requestSignUpDto) | ||
|
||
override suspend fun postSignIn(requestSignInDto: RequestSignInDto): BaseResponse<ResponseSignInDto> = | ||
wavveService.postSignIn(requestSignInDto) | ||
|
||
override suspend fun getUserHobby(): BaseResponse<ResponseUserHobbyDto> = | ||
wavveService.getUserHobby() | ||
|
||
authService.postSignIn(requestSignInDto) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.sopt.and.data.datasourceimpl | ||
|
||
import org.sopt.and.data.datasource.MyDataSource | ||
import org.sopt.and.data.dto.response.BaseResponse | ||
import org.sopt.and.data.dto.response.ResponseUserHobbyDto | ||
import org.sopt.and.data.service.MyService | ||
import javax.inject.Inject | ||
|
||
class MyDataSourceImpl @Inject constructor( | ||
private val myService: MyService | ||
) : MyDataSource { | ||
override suspend fun getUserHobby(): BaseResponse<ResponseUserHobbyDto> = | ||
myService.getUserHobby() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,21 @@ import dagger.Binds | |
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import org.sopt.and.data.datasource.WavveDataSource | ||
import org.sopt.and.data.datasourceimpl.WavveDataSourceImpl | ||
import org.sopt.and.data.datasource.AuthDataSource | ||
import org.sopt.and.data.datasource.MyDataSource | ||
import org.sopt.and.data.datasourceimpl.AuthDataSourceImpl | ||
import org.sopt.and.data.datasourceimpl.MyDataSourceImpl | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal abstract class DataSourceModule { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기에 internal을 붙이시는 이유가 따로 있나요?? |
||
@Binds | ||
@Singleton | ||
abstract fun bindsDataSource(myDataSourceImpl: WavveDataSourceImpl): WavveDataSource | ||
abstract fun bindsAuthDataSource(authDataSourceImpl: AuthDataSourceImpl): AuthDataSource | ||
|
||
@Binds | ||
@Singleton | ||
abstract fun bindsMyDataSource(MyDataSourceImpl: MyDataSourceImpl): MyDataSource | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.sopt.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.MyDataSource | ||
import org.sopt.and.domain.entity.response.ResponseHobbyEntity | ||
import org.sopt.and.domain.repository.MyRepository | ||
import javax.inject.Inject | ||
|
||
class MyRepositoryImpl @Inject constructor( | ||
private val myDataSource: MyDataSource | ||
) : MyRepository { | ||
override suspend fun getHobby(): Result<ResponseHobbyEntity> = runCatching { | ||
myDataSource.getUserHobby().result.toEntity() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.sopt.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.AuthDataSource | ||
import org.sopt.and.data.dto.request.toDto | ||
import org.sopt.and.domain.entity.request.RequestSignInEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignInEntity | ||
import org.sopt.and.domain.repository.SignInRepository | ||
import javax.inject.Inject | ||
|
||
class SignInRepositoryImpl @Inject constructor( | ||
private val authDataSource: AuthDataSource | ||
) : SignInRepository { | ||
override suspend fun signIn(body: RequestSignInEntity): Result<ResponseSignInEntity> = | ||
runCatching { | ||
authDataSource.postSignIn(body.toDto()).result.toEntity() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.sopt.and.data.repositoryimpl | ||
|
||
import org.sopt.and.data.datasource.AuthDataSource | ||
import org.sopt.and.data.dto.request.toDto | ||
import org.sopt.and.domain.entity.request.RequestSignUpEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignUpEntity | ||
import org.sopt.and.domain.repository.SignUpRepository | ||
import javax.inject.Inject | ||
|
||
class SignUpRepositoryImpl @Inject constructor( | ||
private val authDataSource: AuthDataSource | ||
) : SignUpRepository { | ||
override suspend fun signUp(body: RequestSignUpEntity): Result<ResponseSignUpEntity> = | ||
runCatching { | ||
authDataSource.postSignUp(body.toDto()).result.toEntity() | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.sopt.and.data.service | ||
|
||
import org.sopt.and.data.dto.response.BaseResponse | ||
import org.sopt.and.data.dto.response.ResponseUserHobbyDto | ||
import retrofit2.http.GET | ||
|
||
interface MyService { | ||
@GET("/user/my-hobby") | ||
suspend fun getUserHobby(): BaseResponse<ResponseUserHobbyDto> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.sopt.and.domain.repository | ||
|
||
import org.sopt.and.domain.entity.response.ResponseHobbyEntity | ||
|
||
interface MyRepository { | ||
suspend fun getHobby(): Result<ResponseHobbyEntity> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.sopt.and.domain.repository | ||
|
||
import org.sopt.and.domain.entity.request.RequestSignInEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignInEntity | ||
|
||
interface SignInRepository { | ||
suspend fun signIn(body: RequestSignInEntity): Result<ResponseSignInEntity> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.sopt.and.domain.repository | ||
|
||
import org.sopt.and.domain.entity.request.RequestSignUpEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignUpEntity | ||
|
||
interface SignUpRepository { | ||
suspend fun signUp(body: RequestSignUpEntity): Result<ResponseSignUpEntity> | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.sopt.and.domain.usecase | ||
|
||
import org.sopt.and.domain.entity.response.ResponseHobbyEntity | ||
import org.sopt.and.domain.repository.MyRepository | ||
import javax.inject.Inject | ||
|
||
class MyUseCase @Inject constructor( | ||
private val myRepository: MyRepository | ||
) { | ||
suspend operator fun invoke(): Result<ResponseHobbyEntity> = | ||
myRepository.getHobby() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.sopt.and.domain.usecase | ||
|
||
import org.sopt.and.domain.entity.request.RequestSignInEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignInEntity | ||
import org.sopt.and.domain.repository.SignInRepository | ||
import javax.inject.Inject | ||
|
||
class SignInUseCase @Inject constructor( | ||
private val signInRepository: SignInRepository | ||
) { | ||
suspend operator fun invoke(signInEntity: RequestSignInEntity): Result<ResponseSignInEntity> = | ||
signInRepository.signIn(signInEntity) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.sopt.and.domain.usecase | ||
|
||
import org.sopt.and.domain.entity.request.RequestSignUpEntity | ||
import org.sopt.and.domain.entity.response.ResponseSignUpEntity | ||
import org.sopt.and.domain.repository.SignUpRepository | ||
import javax.inject.Inject | ||
|
||
class SignUpUseCase @Inject constructor( | ||
private val signUpRepository: SignUpRepository | ||
) { | ||
suspend operator fun invoke(signUpEntity: RequestSignUpEntity): Result<ResponseSignUpEntity> = | ||
signUpRepository.signUp(signUpEntity) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core 패키지에는 보통 어떤 친구들을 넣어놓으시는지 궁금해요!