From 2dfda7e486639ec92a0841f56f9f9168b29300ea Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 20:12:45 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[REFACTOR]=20=EA=B2=80=EC=83=89=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=EB=AA=A8=EB=8D=B8=20rename?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/dto/response/SearchScrapsResponseDto.kt | 6 +++--- .../data/dto/response/SearchViewsResponseDto.kt | 6 +++--- .../data/repositoryimpl/SearchRepositoryImpl.kt | 6 +++--- ...nshipAnnouncementModel.kt => SearchAnnouncement.kt} | 2 +- .../com/terning/domain/repository/SearchRepository.kt | 6 +++--- .../com/terning/feature/search/search/SearchRoute.kt | 10 +++++----- .../search/search/component/SearchInternList.kt | 6 +++--- .../search/search/model/SearchScrapsListState.kt | 4 ++-- .../search/search/model/SearchViewsListState.kt | 4 ++-- 9 files changed, 25 insertions(+), 25 deletions(-) rename domain/src/main/java/com/terning/domain/entity/response/{InternshipAnnouncementModel.kt => SearchAnnouncement.kt} (76%) diff --git a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt index f099507e6..f1ea971e4 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt @@ -1,6 +1,6 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -20,9 +20,9 @@ data class SearchScrapsResponseDto( val title: String, ) - fun toSearchScrapsEntity(): List { + fun toSearchScrapsEntity(): List { return announcements.map { - InternshipAnnouncementModel( + SearchAnnouncement( announcementId = it.internshipAnnouncementId, companyImage = it.companyImage, title = it.title, diff --git a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt index 99ebe7227..c65467370 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt @@ -1,6 +1,6 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -19,9 +19,9 @@ data class SearchViewsResponseDto( val title: String, ) - fun toSearchViewsEntity(): List { + fun toSearchViewsEntity(): List { return announcements.map { - InternshipAnnouncementModel( + SearchAnnouncement( announcementId = it.internshipAnnouncementId, companyImage = it.companyImage, title = it.title, diff --git a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt index cc2438a5b..d057d67be 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt @@ -2,7 +2,7 @@ package com.terning.data.repositoryimpl import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.request.SearchRequestDto -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import com.terning.domain.entity.response.SearchResultModel import com.terning.domain.repository.SearchRepository import javax.inject.Inject @@ -28,12 +28,12 @@ class SearchRepositoryImpl @Inject constructor( } } - override suspend fun getSearchViewsList(): Result> = + override suspend fun getSearchViewsList(): Result> = runCatching { searchDataSource.getSearchViews().result.toSearchViewsEntity() } - override suspend fun getSearchScrapsList(): Result> = + override suspend fun getSearchScrapsList(): Result> = runCatching { searchDataSource.getSearchScraps().result.toSearchScrapsEntity() } diff --git a/domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt b/domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt similarity index 76% rename from domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt rename to domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt index 23f4adfa1..6c9d7ea3c 100644 --- a/domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncementModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt @@ -1,6 +1,6 @@ package com.terning.domain.entity.response -data class InternshipAnnouncementModel( +data class SearchAnnouncement( val title: String, val companyImage: String, val announcementId: Long, diff --git a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt index 50a29e95f..22f08456c 100644 --- a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt @@ -1,7 +1,7 @@ package com.terning.domain.repository import com.terning.domain.entity.response.SearchResultModel -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement interface SearchRepository { suspend fun getSearchList( @@ -10,6 +10,6 @@ interface SearchRepository { page: Int, size: Int, ): Result> - suspend fun getSearchViewsList(): Result> - suspend fun getSearchScrapsList(): Result> + suspend fun getSearchViewsList(): Result> + suspend fun getSearchScrapsList(): Result> } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 11a76b6d1..f1ea25516 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -28,7 +28,7 @@ import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import com.terning.feature.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType @@ -62,12 +62,12 @@ fun SearchRoute( } val searchViewsList = when (viewState.searchViewsList) { - is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data + is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data else -> emptyList() } val searchScrapsList = when (scrapState.searchScrapsList) { - is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data + is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data else -> emptyList() } @@ -82,8 +82,8 @@ fun SearchRoute( fun SearchScreen( modifier: Modifier = Modifier, navController: NavHostController, - searchViewsList: List, - searchScrapsList: List, + searchViewsList: List, + searchScrapsList: List, ) { val images = listOf( R.drawable.img_ad_1, diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index 132bff1ef..762f3e646 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -12,14 +12,14 @@ import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import com.terning.feature.R @Composable fun SearchInternList( type: InternListType, - searchScrapsList: List?, - searchViewsList: List?, + searchScrapsList: List?, + searchViewsList: List?, navController: NavHostController, ) { Column(modifier = Modifier.padding(horizontal = 24.dp)) { diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt index 8c89cde45..b332a2022 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import com.terning.core.state.UiState data class SearchScrapsListState( - var searchScrapsList: UiState> = UiState.Loading, + var searchScrapsList: UiState> = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt index bc0c6b576..b640cd928 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.InternshipAnnouncementModel +import com.terning.domain.entity.response.SearchAnnouncement import com.terning.core.state.UiState data class SearchViewsListState( - var searchViewsList: UiState> = UiState.Loading, + var searchViewsList: UiState> = UiState.Loading, ) \ No newline at end of file From c45f47281d26d676ddbcb16ad71823779d3b1576 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 20:20:58 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[REFACTOR]=20=EC=8A=A4=ED=81=AC=EB=9E=A9,?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=88=98=20=EB=A7=8E=EC=9D=80=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=EB=A7=B5=ED=8D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datasource/SearchDataSource.kt | 7 ++--- .../datasourceimpl/SearchDataSourceImpl.kt | 7 ++--- ...to.kt => SearchAnnouncementResponseDto.kt} | 13 +------- .../dto/response/SearchViewsResponseDto.kt | 31 ------------------- .../search/SearchAnnouncementListMapper.kt | 14 +++++++++ .../repositoryimpl/SearchRepositoryImpl.kt | 5 +-- .../com/terning/data/service/SearchService.kt | 7 ++--- 7 files changed, 27 insertions(+), 57 deletions(-) rename data/src/main/java/com/terning/data/dto/response/{SearchScrapsResponseDto.kt => SearchAnnouncementResponseDto.kt} (56%) delete mode 100644 data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt create mode 100644 data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt diff --git a/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt b/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt index 9539e0424..5e00c6955 100644 --- a/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt +++ b/data/src/main/java/com/terning/data/datasource/SearchDataSource.kt @@ -3,11 +3,10 @@ package com.terning.data.datasource import com.terning.data.dto.BaseResponse import com.terning.data.dto.request.SearchRequestDto import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto interface SearchDataSource { suspend fun getSearch(request: SearchRequestDto): BaseResponse - suspend fun getSearchViews(): BaseResponse - suspend fun getSearchScraps(): BaseResponse + suspend fun getSearchViews(): BaseResponse + suspend fun getSearchScraps(): BaseResponse } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt index ba16f394a..2d2397e79 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/SearchDataSourceImpl.kt @@ -4,8 +4,7 @@ import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.BaseResponse import com.terning.data.dto.request.SearchRequestDto import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto import com.terning.data.service.SearchService import javax.inject.Inject @@ -22,9 +21,9 @@ class SearchDataSourceImpl @Inject constructor( request.size ) - override suspend fun getSearchViews(): BaseResponse = + override suspend fun getSearchViews(): BaseResponse = searchService.getSearchViewsList() - override suspend fun getSearchScraps(): BaseResponse = + override suspend fun getSearchScraps(): BaseResponse = searchService.getSearchScrapsList() } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt similarity index 56% rename from data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt rename to data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt index f1ea971e4..350218693 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchAnnouncementResponseDto.kt @@ -1,12 +1,11 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.SearchAnnouncement import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class SearchScrapsResponseDto( +data class SearchAnnouncementResponseDto( @SerialName("announcements") val announcements: List, ) { @@ -19,14 +18,4 @@ data class SearchScrapsResponseDto( @SerialName("title") val title: String, ) - - fun toSearchScrapsEntity(): List { - return announcements.map { - SearchAnnouncement( - announcementId = it.internshipAnnouncementId, - companyImage = it.companyImage, - title = it.title, - ) - } - } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt deleted file mode 100644 index c65467370..000000000 --- a/data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.terning.data.dto.response - -import com.terning.domain.entity.response.SearchAnnouncement -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -data class SearchViewsResponseDto( - @SerialName("announcements") - val announcements: List, -) { - @Serializable - data class ViewsAnnouncementDto( - @SerialName("internshipAnnouncementId") - val internshipAnnouncementId: Long, - @SerialName("companyImage") - val companyImage: String, - @SerialName("title") - val title: String, - ) - - fun toSearchViewsEntity(): List { - return announcements.map { - SearchAnnouncement( - announcementId = it.internshipAnnouncementId, - companyImage = it.companyImage, - title = it.title, - ) - } - } -} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt new file mode 100644 index 000000000..a386e6d8e --- /dev/null +++ b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt @@ -0,0 +1,14 @@ +package com.terning.data.mapper.search + +import com.terning.data.dto.response.SearchAnnouncementResponseDto +import com.terning.domain.entity.response.SearchAnnouncement + +fun SearchAnnouncementResponseDto.toSearchAnnouncementList(): List { + return announcements.map { + SearchAnnouncement( + announcementId = it.internshipAnnouncementId, + companyImage = it.companyImage, + title = it.title, + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt index d057d67be..baeea603f 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt @@ -2,6 +2,7 @@ package com.terning.data.repositoryimpl import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.request.SearchRequestDto +import com.terning.data.mapper.search.toSearchAnnouncementList import com.terning.domain.entity.response.SearchAnnouncement import com.terning.domain.entity.response.SearchResultModel import com.terning.domain.repository.SearchRepository @@ -30,11 +31,11 @@ class SearchRepositoryImpl @Inject constructor( override suspend fun getSearchViewsList(): Result> = runCatching { - searchDataSource.getSearchViews().result.toSearchViewsEntity() + searchDataSource.getSearchViews().result.toSearchAnnouncementList() } override suspend fun getSearchScrapsList(): Result> = runCatching { - searchDataSource.getSearchScraps().result.toSearchScrapsEntity() + searchDataSource.getSearchScraps().result.toSearchAnnouncementList() } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/service/SearchService.kt b/data/src/main/java/com/terning/data/service/SearchService.kt index 3f3a25c7b..bd52620cb 100644 --- a/data/src/main/java/com/terning/data/service/SearchService.kt +++ b/data/src/main/java/com/terning/data/service/SearchService.kt @@ -2,8 +2,7 @@ package com.terning.data.service import com.terning.data.dto.BaseResponse import com.terning.data.dto.response.SearchResultResponseDto -import com.terning.data.dto.response.SearchScrapsResponseDto -import com.terning.data.dto.response.SearchViewsResponseDto +import com.terning.data.dto.response.SearchAnnouncementResponseDto import retrofit2.http.GET import retrofit2.http.Query @@ -17,8 +16,8 @@ interface SearchService { ): BaseResponse @GET("api/v1/search/views") - suspend fun getSearchViewsList(): BaseResponse + suspend fun getSearchViewsList(): BaseResponse @GET("api/v1/search/scraps") - suspend fun getSearchScrapsList(): BaseResponse + suspend fun getSearchScrapsList(): BaseResponse } \ No newline at end of file From 9532e72e0e7e66ee22bbe761110c9f460af9b636 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 20:41:27 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[DOCS]=20=EA=B2=80=EC=83=89=EC=B0=BD=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EC=A0=80=EB=B8=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/textfield/SearchTextField.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt index c5aa71711..f030ccec4 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/SearchTextField.kt @@ -11,6 +11,19 @@ import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme + +/** + * 검색창 텍스트 필드 컴포저블입니다. + * + * @param text 텍스트 필드에 표시될 텍스트입니다. + * @param onValueChange 텍스트 필드의 값이 변경될 때 호출되는 콜백 함수입니다. + * @param modifier 텍스트 필드에 적용될 Modifier입니다. + * @param hint 텍스트 필드에 아무것도 입력하지 않았을 때 표시될 힌트 텍스트입니다. + * @param leftIcon 텍스트 필드의 왼쪽에 표시될 아이콘의 리소스 ID입니다. + * @param enabled 텍스트 필드가 활성화되어 있는지 여부를 나타냅니다. + * @param readOnly 텍스트 필드가 읽기 전용인지 여부를 나타냅니다. + * @param onSearchAction 사용자가 키보드에서 검색을 실행할 때 호출되는 콜백 함수입니다. + */ @Composable fun SearchTextField( text: String = "", From 72d21143d1fc0d0130245335c0847dc13073bdd1 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 20:41:54 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[REFACTOR]=20=EA=B2=80=EC=83=89=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=ED=8C=A8=ED=82=A4=EC=A7=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/dto/response/SearchResultResponseDto.kt | 6 +++--- .../data/mapper/search/SearchAnnouncementListMapper.kt | 2 +- .../com/terning/data/repositoryimpl/SearchRepositoryImpl.kt | 6 +++--- .../entity/{response => search}/SearchAnnouncement.kt | 2 +- .../SearchResultModel.kt => search/SearchResult.kt} | 4 ++-- .../java/com/terning/domain/repository/SearchRepository.kt | 6 +++--- .../java/com/terning/feature/search/search/SearchRoute.kt | 2 +- .../feature/search/search/component/SearchInternList.kt | 2 +- .../feature/search/search/model/SearchScrapsListState.kt | 2 +- .../feature/search/search/model/SearchViewsListState.kt | 2 +- .../feature/search/searchprocess/SearchProcessViewModel.kt | 6 +++--- .../search/searchprocess/models/SearchResultState.kt | 4 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) rename domain/src/main/java/com/terning/domain/entity/{response => search}/SearchAnnouncement.kt (72%) rename domain/src/main/java/com/terning/domain/entity/{response/SearchResultModel.kt => search/SearchResult.kt} (77%) diff --git a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt index 35a1baba1..16dc73431 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt @@ -1,6 +1,6 @@ package com.terning.data.dto.response -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchResult import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -35,9 +35,9 @@ data class SearchResultResponseDto( val deadline: String, ) - fun toSearchResultEntity(): List { + fun toSearchResultEntity(): List { return announcements.map { - SearchResultModel( + SearchResult( internshipAnnouncementId = it.internshipAnnouncementId, title = it.title, dDay = it.dDay, diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt index a386e6d8e..4f65321f2 100644 --- a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt @@ -1,7 +1,7 @@ package com.terning.data.mapper.search import com.terning.data.dto.response.SearchAnnouncementResponseDto -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchAnnouncement fun SearchAnnouncementResponseDto.toSearchAnnouncementList(): List { return announcements.map { diff --git a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt index baeea603f..e82ac55fa 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt @@ -3,8 +3,8 @@ package com.terning.data.repositoryimpl import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.request.SearchRequestDto import com.terning.data.mapper.search.toSearchAnnouncementList -import com.terning.domain.entity.response.SearchAnnouncement -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.SearchRepository import javax.inject.Inject @@ -16,7 +16,7 @@ class SearchRepositoryImpl @Inject constructor( sortBy: String, page: Int, size: Int, - ): Result> { + ): Result> { return runCatching { searchDataSource.getSearch( SearchRequestDto( diff --git a/domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt b/domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt similarity index 72% rename from domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt rename to domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt index 6c9d7ea3c..16e05d7f8 100644 --- a/domain/src/main/java/com/terning/domain/entity/response/SearchAnnouncement.kt +++ b/domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt @@ -1,4 +1,4 @@ -package com.terning.domain.entity.response +package com.terning.domain.entity.search data class SearchAnnouncement( val title: String, diff --git a/domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt b/domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt similarity index 77% rename from domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt rename to domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt index c6714f598..057357870 100644 --- a/domain/src/main/java/com/terning/domain/entity/response/SearchResultModel.kt +++ b/domain/src/main/java/com/terning/domain/entity/search/SearchResult.kt @@ -1,6 +1,6 @@ -package com.terning.domain.entity.response +package com.terning.domain.entity.search -data class SearchResultModel( +data class SearchResult( val internshipAnnouncementId: Long, val title: String, val dDay: String, diff --git a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt index 22f08456c..514221dd4 100644 --- a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt @@ -1,7 +1,7 @@ package com.terning.domain.repository -import com.terning.domain.entity.response.SearchResultModel -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchResult +import com.terning.domain.entity.search.SearchAnnouncement interface SearchRepository { suspend fun getSearchList( @@ -9,7 +9,7 @@ interface SearchRepository { sortBy: String, page: Int, size: Int, - ): Result> + ): Result> suspend fun getSearchViewsList(): Result> suspend fun getSearchScrapsList(): Result> } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index f1ea25516..bfa05af9d 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -28,7 +28,7 @@ import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchAnnouncement import com.terning.feature.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index 762f3e646..e595aed7c 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchAnnouncement import com.terning.feature.R @Composable diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt index b332a2022..d8a3d9f1a 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt @@ -1,6 +1,6 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchAnnouncement import com.terning.core.state.UiState data class SearchScrapsListState( diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt index b640cd928..ddb9c4668 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt @@ -1,6 +1,6 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.response.SearchAnnouncement +import com.terning.domain.entity.search.SearchAnnouncement import com.terning.core.state.UiState data class SearchViewsListState( diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt index a12ef5d40..a36b01dcd 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessViewModel.kt @@ -4,7 +4,7 @@ import androidx.compose.ui.graphics.Color import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.domain.entity.CalendarScrapRequest -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.ScrapRepository import com.terning.domain.repository.SearchRepository import com.terning.feature.R @@ -37,8 +37,8 @@ class SearchProcessViewModel @Inject constructor( MutableStateFlow(SearchResultState()) val searchListState: StateFlow = _searchListState.asStateFlow() - private val _internSearchResultData = MutableStateFlow>(emptyList()) - val internSearchResultData: StateFlow> = + private val _internSearchResultData = MutableStateFlow>(emptyList()) + val internSearchResultData: StateFlow> = _internSearchResultData.asStateFlow() private val _dialogState: MutableStateFlow = diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt index 09bbedbd9..8cb4b6856 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/models/SearchResultState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.searchprocess.models import com.terning.core.state.UiState -import com.terning.domain.entity.response.SearchResultModel +import com.terning.domain.entity.search.SearchResult data class SearchResultState( - var searchListState: UiState> = UiState.Loading, + var searchListState: UiState> = UiState.Loading, ) \ No newline at end of file From 26bc27d8a52f74deadb2471ba26e68d00988cc54 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 22:54:43 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[REFACTOR]=20=EA=B2=80=EC=83=89=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EB=A7=B5=ED=8D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SearchResultResponseDto.kt | 16 -------------- .../search/SearchAnnouncementListMapper.kt | 6 +++--- .../data/mapper/search/SearchResultMapper.kt | 21 +++++++++++++++++++ .../repositoryimpl/SearchRepositoryImpl.kt | 15 ++++++------- ...cement.kt => SearchPopularAnnouncement.kt} | 2 +- .../domain/repository/SearchRepository.kt | 6 +++--- .../feature/search/search/SearchRoute.kt | 10 ++++----- .../search/component/SearchInternList.kt | 6 +++--- .../search/model/SearchScrapsListState.kt | 4 ++-- .../search/model/SearchViewsListState.kt | 4 ++-- 10 files changed, 48 insertions(+), 42 deletions(-) create mode 100644 data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt rename domain/src/main/java/com/terning/domain/entity/search/{SearchAnnouncement.kt => SearchPopularAnnouncement.kt} (76%) diff --git a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt index 16dc73431..58bcda8ac 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt @@ -34,20 +34,4 @@ data class SearchResultResponseDto( @SerialName("deadline") val deadline: String, ) - - fun toSearchResultEntity(): List { - return announcements.map { - SearchResult( - internshipAnnouncementId = it.internshipAnnouncementId, - title = it.title, - dDay = it.dDay, - workingPeriod = it.workingPeriod, - companyImage = it.companyImage, - scrapId = it.scrapId, - deadline = it.deadline, - startYearMonth = it.startYearMonth, - color = it.color - ) - } - } } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt index 4f65321f2..739297bff 100644 --- a/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/search/SearchAnnouncementListMapper.kt @@ -1,11 +1,11 @@ package com.terning.data.mapper.search import com.terning.data.dto.response.SearchAnnouncementResponseDto -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement -fun SearchAnnouncementResponseDto.toSearchAnnouncementList(): List { +fun SearchAnnouncementResponseDto.toSearchPopularAnnouncementList(): List { return announcements.map { - SearchAnnouncement( + SearchPopularAnnouncement( announcementId = it.internshipAnnouncementId, companyImage = it.companyImage, title = it.title, diff --git a/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt b/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt new file mode 100644 index 000000000..4d61da372 --- /dev/null +++ b/data/src/main/java/com/terning/data/mapper/search/SearchResultMapper.kt @@ -0,0 +1,21 @@ +package com.terning.data.mapper.search + +import com.terning.data.dto.response.SearchResultResponseDto +import com.terning.domain.entity.search.SearchResult + + +fun SearchResultResponseDto.toSearchResultList(): List { + return announcements.map { + SearchResult( + internshipAnnouncementId = it.internshipAnnouncementId, + title = it.title, + dDay = it.dDay, + workingPeriod = it.workingPeriod, + companyImage = it.companyImage, + scrapId = it.scrapId, + deadline = it.deadline, + startYearMonth = it.startYearMonth, + color = it.color + ) + } +} \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt index e82ac55fa..80bbea1c0 100644 --- a/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt +++ b/data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.kt @@ -2,8 +2,9 @@ package com.terning.data.repositoryimpl import com.terning.data.datasource.SearchDataSource import com.terning.data.dto.request.SearchRequestDto -import com.terning.data.mapper.search.toSearchAnnouncementList -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.data.mapper.search.toSearchPopularAnnouncementList +import com.terning.data.mapper.search.toSearchResultList +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.domain.entity.search.SearchResult import com.terning.domain.repository.SearchRepository import javax.inject.Inject @@ -25,17 +26,17 @@ class SearchRepositoryImpl @Inject constructor( page = page, size = size ) - ).result.toSearchResultEntity() + ).result.toSearchResultList() } } - override suspend fun getSearchViewsList(): Result> = + override suspend fun getSearchViewsList(): Result> = runCatching { - searchDataSource.getSearchViews().result.toSearchAnnouncementList() + searchDataSource.getSearchViews().result.toSearchPopularAnnouncementList() } - override suspend fun getSearchScrapsList(): Result> = + override suspend fun getSearchScrapsList(): Result> = runCatching { - searchDataSource.getSearchScraps().result.toSearchAnnouncementList() + searchDataSource.getSearchScraps().result.toSearchPopularAnnouncementList() } } \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt b/domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt similarity index 76% rename from domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt rename to domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt index 16e05d7f8..4866d3179 100644 --- a/domain/src/main/java/com/terning/domain/entity/search/SearchAnnouncement.kt +++ b/domain/src/main/java/com/terning/domain/entity/search/SearchPopularAnnouncement.kt @@ -1,6 +1,6 @@ package com.terning.domain.entity.search -data class SearchAnnouncement( +data class SearchPopularAnnouncement( val title: String, val companyImage: String, val announcementId: Long, diff --git a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt index 514221dd4..f4f94ab53 100644 --- a/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt +++ b/domain/src/main/java/com/terning/domain/repository/SearchRepository.kt @@ -1,7 +1,7 @@ package com.terning.domain.repository import com.terning.domain.entity.search.SearchResult -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement interface SearchRepository { suspend fun getSearchList( @@ -10,6 +10,6 @@ interface SearchRepository { page: Int, size: Int, ): Result> - suspend fun getSearchViewsList(): Result> - suspend fun getSearchScrapsList(): Result> + suspend fun getSearchViewsList(): Result> + suspend fun getSearchScrapsList(): Result> } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index bfa05af9d..2fa13f3a0 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -28,7 +28,7 @@ import com.terning.core.designsystem.theme.Grey100 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.feature.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType @@ -62,12 +62,12 @@ fun SearchRoute( } val searchViewsList = when (viewState.searchViewsList) { - is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data + is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data else -> emptyList() } val searchScrapsList = when (scrapState.searchScrapsList) { - is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data + is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data else -> emptyList() } @@ -82,8 +82,8 @@ fun SearchRoute( fun SearchScreen( modifier: Modifier = Modifier, navController: NavHostController, - searchViewsList: List, - searchScrapsList: List, + searchViewsList: List, + searchScrapsList: List, ) { val images = listOf( R.drawable.img_ad_1, diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index e595aed7c..3a685fc16 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -12,14 +12,14 @@ import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.feature.R @Composable fun SearchInternList( type: InternListType, - searchScrapsList: List?, - searchViewsList: List?, + searchScrapsList: List?, + searchViewsList: List?, navController: NavHostController, ) { Column(modifier = Modifier.padding(horizontal = 24.dp)) { diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt index d8a3d9f1a..d52f3c17e 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchScrapsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.core.state.UiState data class SearchScrapsListState( - var searchScrapsList: UiState> = UiState.Loading, + var searchScrapsList: UiState> = UiState.Loading, ) diff --git a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt index ddb9c4668..5550e1e3c 100644 --- a/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt +++ b/feature/src/main/java/com/terning/feature/search/search/model/SearchViewsListState.kt @@ -1,8 +1,8 @@ package com.terning.feature.search.search.model -import com.terning.domain.entity.search.SearchAnnouncement +import com.terning.domain.entity.search.SearchPopularAnnouncement import com.terning.core.state.UiState data class SearchViewsListState( - var searchViewsList: UiState> = UiState.Loading, + var searchViewsList: UiState> = UiState.Loading, ) \ No newline at end of file From d96e173238d882433f5367047e41df50de747cef Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 23:28:52 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[REFACTOR]=20navigateToSearchProcess=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20immutable?= =?UTF-8?q?List=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/search/search/SearchRoute.kt | 26 ++++++++++--------- .../search/search/component/SearchIntern.kt | 6 ++--- .../search/component/SearchInternList.kt | 11 ++++---- .../search/navigation/SearchNavigation.kt | 5 +++- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 2fa13f3a0..3d4b3f611 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -20,7 +20,6 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import androidx.navigation.NavHostController import com.terning.core.designsystem.component.textfield.SearchTextField import com.terning.core.designsystem.component.topappbar.LogoTopAppBar import com.terning.core.designsystem.theme.Black @@ -33,11 +32,12 @@ import com.terning.feature.R import com.terning.feature.search.search.component.ImageSlider import com.terning.feature.search.search.component.InternListType import com.terning.feature.search.search.component.SearchInternList -import com.terning.feature.search.searchprocess.navigation.navigateSearchProcess +import okhttp3.internal.toImmutableList @Composable fun SearchRoute( - navController: NavHostController, + navigateToSearchProcess: () -> Unit, + navigateToIntern: (Long) -> Unit, viewModel: SearchViewModel = hiltViewModel(), ) { val lifecycleOwner = LocalLifecycleOwner.current @@ -62,29 +62,32 @@ fun SearchRoute( } val searchViewsList = when (viewState.searchViewsList) { - is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data + is UiState.Success -> (viewState.searchViewsList as UiState.Success>).data.toImmutableList() else -> emptyList() } val searchScrapsList = when (scrapState.searchScrapsList) { - is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data + is UiState.Success -> (scrapState.searchScrapsList as UiState.Success>).data.toImmutableList() else -> emptyList() } SearchScreen( - navController = navController, searchViewsList = searchViewsList, - searchScrapsList = searchScrapsList + searchScrapsList = searchScrapsList, + navigateToSearchProcess = navigateToSearchProcess, + navigateToIntern = navigateToIntern, ) } @Composable fun SearchScreen( modifier: Modifier = Modifier, - navController: NavHostController, searchViewsList: List, searchScrapsList: List, + navigateToSearchProcess: () -> Unit, + navigateToIntern: (Long) -> Unit, ) { + val images = listOf( R.drawable.img_ad_1, R.drawable.img_ad_2, @@ -109,7 +112,7 @@ fun SearchScreen( vertical = 16.dp ) .noRippleClickable { - navController.navigateSearchProcess() + navigateToSearchProcess() } ) { SearchTextField( @@ -133,12 +136,11 @@ fun SearchScreen( style = TerningTheme.typography.title1, color = Black ) - SearchInternList( type = InternListType.VIEW, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, - navController = navController + navigateToIntern = navigateToIntern, ) HorizontalDivider( thickness = 4.dp, @@ -149,7 +151,7 @@ fun SearchScreen( type = InternListType.SCRAP, searchViewsList = searchViewsList, searchScrapsList = searchScrapsList, - navController = navController + navigateToIntern = navigateToIntern, ) } } diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt index 8065cc0f0..3d11ab374 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchIntern.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp -import androidx.navigation.NavHostController import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.designsystem.theme.Black @@ -34,14 +33,13 @@ import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.White import com.terning.core.extension.noRippleClickable import com.terning.feature.R -import com.terning.feature.intern.navigation.navigateIntern @Composable fun SearchIntern( companyImage: String, title: String, - navController: NavHostController, announcementId: Long, + navigateToIntern: (Long) -> Unit, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -63,7 +61,7 @@ fun SearchIntern( ) .padding(top = 8.dp) .noRippleClickable { - navController.navigateIntern(announcementId = announcementId) + navigateToIntern(announcementId) } ) { AsyncImage( diff --git a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt index 3a685fc16..5a0099763 100644 --- a/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt +++ b/feature/src/main/java/com/terning/feature/search/search/component/SearchInternList.kt @@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.navigation.NavHostController import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme import com.terning.domain.entity.search.SearchPopularAnnouncement @@ -20,7 +19,7 @@ fun SearchInternList( type: InternListType, searchScrapsList: List?, searchViewsList: List?, - navController: NavHostController, + navigateToIntern: (Long) -> Unit, ) { Column(modifier = Modifier.padding(horizontal = 24.dp)) { Text( @@ -44,8 +43,8 @@ fun SearchInternList( SearchIntern( companyImage = searchViewsList[index].companyImage, title = searchViewsList[index].title, - navController = navController, - announcementId = searchViewsList[index].announcementId + announcementId = searchViewsList[index].announcementId, + navigateToIntern = navigateToIntern, ) } } @@ -55,8 +54,8 @@ fun SearchInternList( SearchIntern( companyImage = searchScrapsList[index].companyImage, title = searchScrapsList[index].title, - navController = navController, - announcementId = searchScrapsList[index].announcementId + announcementId = searchScrapsList[index].announcementId, + navigateToIntern = navigateToIntern, ) } } diff --git a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt index fabf93899..7986a09df 100644 --- a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt +++ b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt @@ -8,7 +8,9 @@ import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute +import com.terning.feature.intern.navigation.navigateIntern import com.terning.feature.search.search.SearchRoute +import com.terning.feature.search.searchprocess.navigation.navigateSearchProcess import kotlinx.serialization.Serializable fun NavController.navigateSearch(navOptions: NavOptions? = null) { @@ -36,7 +38,8 @@ fun NavGraphBuilder.searchNavGraph( } ) { SearchRoute( - navController = navHostController + navigateToSearchProcess = { navHostController.navigateSearchProcess() }, + navigateToIntern = { announcementId -> navHostController.navigateIntern() } ) } } From 2a353779e949da1b6defb6b8128670a86f9b692b Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 23:31:15 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[REFACTOR]=20=ED=83=90=EC=83=89=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=EC=84=9C=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EC=8B=9C=20announcementId=20=EB=84=98=EA=B8=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/navigation/InternNavigation.kt | 2 +- .../feature/search/search/navigation/SearchNavigation.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index 90c845b17..486134573 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -13,8 +13,8 @@ import com.terning.feature.intern.InternRoute import kotlinx.serialization.Serializable fun NavController.navigateIntern( - navOptions: NavOptions? = null, announcementId: Long = 0, + navOptions: NavOptions? = null, ) { navigate( route = Intern(announcementId), diff --git a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt index 7986a09df..98a5a730d 100644 --- a/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt +++ b/feature/src/main/java/com/terning/feature/search/search/navigation/SearchNavigation.kt @@ -39,7 +39,7 @@ fun NavGraphBuilder.searchNavGraph( ) { SearchRoute( navigateToSearchProcess = { navHostController.navigateSearchProcess() }, - navigateToIntern = { announcementId -> navHostController.navigateIntern() } + navigateToIntern = { announcementId -> navHostController.navigateIntern(announcementId) } ) } } From 13d3a671f554a4d3572128a1b320839ee3243c73 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 21 Aug 2024 23:37:45 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[DELETE]=20=EC=95=88=EC=93=B0=EB=8A=94=20im?= =?UTF-8?q?port=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/data/dto/response/SearchResultResponseDto.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt index 58bcda8ac..14e7e4bf2 100644 --- a/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/SearchResultResponseDto.kt @@ -1,6 +1,5 @@ package com.terning.data.dto.response -import com.terning.domain.entity.search.SearchResult import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable