From ba7bf35b6a92d774243059da8fa7d37a576247be Mon Sep 17 00:00:00 2001 From: Hyobeen-Park Date: Wed, 18 Dec 2024 14:14:45 +0900 Subject: [PATCH] =?UTF-8?q?[REFACTOR/#308]=20=EB=94=B1=20=EB=A7=9E?= =?UTF-8?q?=EB=8A=94=20=EC=9D=B8=ED=84=B4=20=EA=B3=B5=EA=B3=A0=20=ED=8C=8C?= =?UTF-8?q?=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/home/datasource/HomeDataSource.kt | 2 -- .../data/home/datasourceimpl/HomeDataSourceImpl.kt | 4 ---- .../data/home/repositoryimpl/HomeRepositoryImpl.kt | 4 ---- .../java/com/terning/data/home/service/HomeService.kt | 2 -- .../terning/domain/home/repository/HomeRepository.kt | 2 -- .../main/java/com/terning/feature/home/HomeRoute.kt | 6 +----- .../java/com/terning/feature/home/HomeViewModel.kt | 11 +---------- 7 files changed, 2 insertions(+), 29 deletions(-) diff --git a/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt b/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt index 21520cc7..0c255517 100644 --- a/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt +++ b/data/home/src/main/java/com/terning/data/home/datasource/HomeDataSource.kt @@ -12,8 +12,6 @@ interface HomeDataSource { suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): BaseResponse suspend fun getFilteringInfo(): BaseResponse diff --git a/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt b/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt index cc73df1b..973151a6 100644 --- a/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt +++ b/data/home/src/main/java/com/terning/data/home/datasourceimpl/HomeDataSourceImpl.kt @@ -18,13 +18,9 @@ class HomeDataSourceImpl @Inject constructor( override suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): BaseResponse = homeService.getRecommendIntern( sortBy = sortBy, - startYear = startYear, - startMonth = startMonth ) override suspend fun getFilteringInfo(): BaseResponse = diff --git a/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt b/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt index 8c01ea9c..d0677159 100644 --- a/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt +++ b/data/home/src/main/java/com/terning/data/home/repositoryimpl/HomeRepositoryImpl.kt @@ -22,14 +22,10 @@ class HomeRepositoryImpl @Inject constructor( override suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): Result = runCatching { homeDataSource.getRecommendIntern( sortBy = sortBy, - startYear = startYear, - startMonth = startMonth ).result.toHomeRecommendInternList() } diff --git a/data/home/src/main/java/com/terning/data/home/service/HomeService.kt b/data/home/src/main/java/com/terning/data/home/service/HomeService.kt index 1215a33e..cc54844b 100644 --- a/data/home/src/main/java/com/terning/data/home/service/HomeService.kt +++ b/data/home/src/main/java/com/terning/data/home/service/HomeService.kt @@ -18,8 +18,6 @@ interface HomeService { @GET("api/v1/home") suspend fun getRecommendIntern( @Query("sortBy") sortBy: String, - @Query("startYear") startYear: Int, - @Query("startMonth") startMonth: Int, ): BaseResponse @GET("api/v1/filters") diff --git a/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt b/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt index e7b7f432..609212b3 100644 --- a/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt +++ b/domain/home/src/main/java/com/terning/domain/home/repository/HomeRepository.kt @@ -10,8 +10,6 @@ interface HomeRepository { suspend fun getRecommendIntern( sortBy: String, - startYear: Int, - startMonth: Int ): Result suspend fun getFilteringInfo(): Result diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt index 0997fd21..555d68f9 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt @@ -128,7 +128,7 @@ fun HomeScreen( navigateToCalendar: () -> Unit, updateRecommendDialogVisibility: (Boolean) -> Unit, getHomeUpcomingInternList: () -> Unit, - getRecommendInternsData: (Int, Int?, Int?) -> Unit, + getRecommendInternsData: (Int) -> Unit, viewModel: HomeViewModel, ) { val homeState by viewModel.homeState.collectAsStateWithLifecycle() @@ -221,8 +221,6 @@ fun HomeScreen( getHomeUpcomingInternList() getRecommendInternsData( homeState.sortBy.ordinal, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth ) } } @@ -242,8 +240,6 @@ fun HomeScreen( if (isScrapped) { getRecommendInternsData( homeState.sortBy.ordinal, - homeFilteringInfo.startYear, - homeFilteringInfo.startMonth ) getHomeUpcomingInternList() } diff --git a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt index 57dbe67e..41288c4d 100644 --- a/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/terning/feature/home/HomeViewModel.kt @@ -2,8 +2,6 @@ package com.terning.feature.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.terning.core.designsystem.extension.currentMonth -import com.terning.core.designsystem.extension.currentYear import com.terning.core.designsystem.state.UiState import com.terning.core.designsystem.type.SortBy import com.terning.domain.home.entity.ChangeFilteringRequestModel @@ -17,7 +15,6 @@ import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import java.util.Calendar import javax.inject.Inject @HiltViewModel @@ -31,12 +28,10 @@ class HomeViewModel @Inject constructor( private val _homeSideEffect = MutableSharedFlow() val homeSideEffect get() = _homeSideEffect.asSharedFlow() - fun getRecommendInternsData(sortBy: Int, startYear: Int?, startMonth: Int?) { + fun getRecommendInternsData(sortBy: Int) { viewModelScope.launch { homeRepository.getRecommendIntern( sortBy = SortBy.entries[sortBy].type, - startYear ?: Calendar.getInstance().currentYear, - startMonth ?: Calendar.getInstance().currentMonth, ).onSuccess { internList -> _homeState.value = _homeState.value.copy( homeRecommendInternState = UiState.Success(internList) @@ -74,8 +69,6 @@ class HomeViewModel @Inject constructor( if (filteringInfo.grade != null) { getRecommendInternsData( sortBy = _homeState.value.sortBy.ordinal, - startYear = filteringInfo.startYear, - startMonth = filteringInfo.startMonth, ) getHomeUpcomingInternList() } @@ -158,8 +151,6 @@ class HomeViewModel @Inject constructor( } getRecommendInternsData( _homeState.value.sortBy.ordinal, - startYear ?: Calendar.getInstance().currentYear, - startMonth ?: Calendar.getInstance().currentMonth, ) }