-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT/#85] ํ์ ๋ทฐ / ์คํฌ๋ฉ ๋ง์ ๊ณต๊ณ ํต์
- Loading branch information
Showing
21 changed files
with
180 additions
and
81 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -104,5 +104,4 @@ object RetrofitModule { | |
.client(client) | ||
.addConverterFactory(factory) | ||
.build() | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
data/src/main/java/com/terning/data/datasource/SearchDataSource.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,8 +1,10 @@ | ||
package com.terning.data.datasource | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.SearchScrapsResponseDto | ||
import com.terning.data.dto.response.SearchViewsResponseDto | ||
|
||
interface SearchDataSource { | ||
suspend fun getSearchViews(): BaseResponse<SearchViewsResponseDto> | ||
suspend fun getSearchScraps(): BaseResponse<SearchScrapsResponseDto> | ||
} |
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
34 changes: 34 additions & 0 deletions
34
data/src/main/java/com/terning/data/dto/response/SearchScrapsResponseDto.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,34 @@ | ||
package com.terning.data.dto.response | ||
|
||
import InternshipAnnouncement | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
|
||
@Serializable | ||
data class SearchScrapsResponseDto( | ||
@SerialName("announcements") | ||
val announcements: List<ScrapsAnnouncementDto>, | ||
) { | ||
@Serializable | ||
data class ScrapsAnnouncementDto( | ||
@SerialName("internshipAnnouncementId") | ||
val internshipAnnouncementId: Long, | ||
@SerialName("companyImage") | ||
val companyImage: String, | ||
@SerialName("title") | ||
val title: String, | ||
) | ||
|
||
fun toSearchScrapsEntity(): List<InternshipAnnouncement> { | ||
return announcements.map { | ||
InternshipAnnouncement( | ||
announcementId = it.internshipAnnouncementId, | ||
companyImage = it.companyImage, | ||
title = it.title, | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
30 changes: 17 additions & 13 deletions
30
data/src/main/java/com/terning/data/dto/response/SearchViewsResponseDto.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,27 +1,31 @@ | ||
package com.terning.data.dto.response | ||
|
||
import com.terning.domain.entity.response.InternshipAnnouncement | ||
import InternshipAnnouncement | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SearchViewsResponseDto( | ||
@SerialName("internshipAnnouncementId") | ||
val internshipAnnouncementId: Long, | ||
@SerialName("companyImage") | ||
val companyImage: String, | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("announcements") | ||
val announcements: List<ViewsAnnouncementDto>, | ||
) { | ||
|
||
@Serializable | ||
data class ViewsAnnouncementDto( | ||
@SerialName("internshipAnnouncementId") | ||
val internshipAnnouncementId: Long, | ||
@SerialName("companyImage") | ||
val companyImage: String, | ||
@SerialName("title") | ||
val title: String, | ||
) | ||
|
||
fun toSearchViewsEntity(): List<InternshipAnnouncement> { | ||
return listOf( | ||
return announcements.map { | ||
InternshipAnnouncement( | ||
announcementId = internshipAnnouncementId, | ||
companyImage = companyImage, | ||
title = title, | ||
announcementId = it.internshipAnnouncementId, | ||
companyImage = it.companyImage, | ||
title = it.title, | ||
) | ||
) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/terning/data/repositoryimpl/SearchRepositoryImpl.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,18 @@ | ||
package com.terning.data.repositoryimpl | ||
|
||
import InternshipAnnouncement | ||
import com.terning.data.datasource.SearchDataSource | ||
import com.terning.domain.repository.SearchRepository | ||
import javax.inject.Inject | ||
|
||
class SearchRepositoryImpl @Inject constructor( | ||
private val searchDataSource: SearchDataSource, | ||
) : SearchRepository { | ||
override suspend fun getSearchViewsList(): Result<List<InternshipAnnouncement>> = runCatching { | ||
searchDataSource.getSearchViews().result.toSearchViewsEntity() | ||
} | ||
|
||
override suspend fun getSearchScrapsList(): Result<List<InternshipAnnouncement>> = runCatching { | ||
searchDataSource.getSearchScraps().result.toSearchScrapsEntity() | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
data/src/main/java/com/terning/data/repositoryimpl/SearchViewsRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -23,5 +23,4 @@ class TokenRepositoryImpl @Inject constructor( | |
override fun clearInfo() { | ||
terningDataStore.clearInfo() | ||
} | ||
|
||
} |
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,10 +1,14 @@ | ||
package com.terning.data.service | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.SearchScrapsResponseDto | ||
import com.terning.data.dto.response.SearchViewsResponseDto | ||
import retrofit2.http.GET | ||
|
||
interface SearchService { | ||
@GET("api/v1/search/views") | ||
suspend fun getSearchViewsList(): BaseResponse<SearchViewsResponseDto> | ||
|
||
@GET("api/v1/search/scraps") | ||
suspend fun getSearchScrapsList(): BaseResponse<SearchScrapsResponseDto> | ||
} |
2 changes: 0 additions & 2 deletions
2
domain/src/main/java/com/terning/domain/entity/response/InternshipAnnouncement.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
3 changes: 2 additions & 1 deletion
3
domain/src/main/java/com/terning/domain/repository/SearchRepository.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,7 +1,8 @@ | ||
package com.terning.domain.repository | ||
|
||
import com.terning.domain.entity.response.InternshipAnnouncement | ||
import InternshipAnnouncement | ||
|
||
interface SearchRepository { | ||
suspend fun getSearchViewsList(): Result<List<InternshipAnnouncement>> | ||
suspend fun getSearchScrapsList(): Result<List<InternshipAnnouncement>> | ||
} |
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
7 changes: 7 additions & 0 deletions
7
feature/src/main/java/com/terning/feature/search/search/SearchSideEffect.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,7 @@ | ||
package com.terning.feature.search.search | ||
|
||
import androidx.annotation.StringRes | ||
|
||
sealed class SearchSideEffect { | ||
data class Toast(@StringRes val message: Int) : SearchSideEffect() | ||
} |
9 changes: 9 additions & 0 deletions
9
feature/src/main/java/com/terning/feature/search/search/SearchState.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 com.terning.feature.search.search | ||
|
||
import InternshipAnnouncement | ||
import com.terning.core.state.UiState | ||
|
||
data class SearchState( | ||
var searchViewsList: UiState<List<InternshipAnnouncement>> = UiState.Loading, | ||
var searchScrapsList: UiState<List<InternshipAnnouncement>> = UiState.Loading, | ||
) |
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
7 changes: 0 additions & 7 deletions
7
feature/src/main/java/com/terning/feature/search/search/SearchViewsSideEffect.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
feature/src/main/java/com/terning/feature/search/search/SearchViewsState.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
Oops, something went wrong.