Skip to content

Commit

Permalink
feat/#8: 각각 module에 auth service, datasource, repository provide 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyein9892 committed Nov 15, 2024
1 parent 2ad9f31 commit 10a14cf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions data/src/main/java/org/sopt/and/data/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.sopt.and.data.datasource.AuthDataSource
import org.sopt.and.data.datasource.UserDataSource
import org.sopt.and.data.service.AuthService
import org.sopt.and.data.service.UserService
import javax.inject.Singleton

Expand All @@ -20,4 +22,11 @@ internal object DataSourceModule {
userService: UserService
): UserDataSource = UserDataSource(userSharedPreference, userService)

@Singleton
@Provides
fun provideAuthDataSource(
authService: AuthService
): AuthDataSource = AuthDataSource(authService)


}
5 changes: 5 additions & 0 deletions data/src/main/java/org/sopt/and/data/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.sopt.and.data.repository.AuthRepositoryImpl
import org.sopt.and.data.repository.UserRepositoryImpl
import org.sopt.and.domain.repository.AuthRepository
import org.sopt.and.domain.repository.UserRepository

@Module
Expand All @@ -13,4 +15,7 @@ internal interface RepositoryModule {

@Binds
fun bindUserRepository(userRepositoryImpl: UserRepositoryImpl): UserRepository

@Binds
fun bindAuthRepository(authRepositoryImpl: AuthRepositoryImpl): AuthRepository
}
7 changes: 7 additions & 0 deletions data/src/main/java/org/sopt/and/data/di/ServiceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.sopt.and.data.service.AuthService
import org.sopt.and.data.service.UserService
import retrofit2.Retrofit
import javax.inject.Singleton
Expand All @@ -17,4 +18,10 @@ internal object ServiceModule {
fun provideUserService(
retrofit: Retrofit
): UserService = retrofit.create(UserService::class.java)

@Provides
@Singleton
fun provideAuthService(
retrofit: Retrofit
): AuthService = retrofit.create(AuthService::class.java)
}

0 comments on commit 10a14cf

Please sign in to comment.