Skip to content

Commit

Permalink
[MERGE] #247 -> develop
Browse files Browse the repository at this point in the history
[FIX/#247] ν™ˆ λ·° / μΆ”κ°€ μˆ˜μ •μ‚¬ν•­ 반영
  • Loading branch information
Hyobeen-Park authored Sep 23, 2024
2 parents 54e6bd8 + 27b5e6b commit a247ff1
Show file tree
Hide file tree
Showing 27 changed files with 185 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -32,7 +32,7 @@ fun SortingBottomSheet(
onDismiss: () -> Unit,
currentSortBy: Int,
modifier: Modifier = Modifier,
newSortBy: MutableState<Int> = mutableStateOf(currentSortBy),
newSortBy: MutableState<Int> = mutableIntStateOf(currentSortBy),
onSortChange: (Int) -> Unit = {},
) {
val scope = rememberCoroutineScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.terning.data.dto.response.HomeRecommendInternResponseDto
import com.terning.data.dto.response.HomeUpcomingInternResponseDto

interface HomeDataSource {
suspend fun getUpcomingIntern(): BaseResponse<List<HomeUpcomingInternResponseDto>>
suspend fun getUpcomingIntern(): BaseResponse<HomeUpcomingInternResponseDto>

suspend fun getRecommendIntern(
sortBy: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import javax.inject.Inject
class HomeDataSourceImpl @Inject constructor(
private val homeService: HomeService,
) : HomeDataSource {
override suspend fun getUpcomingIntern(): BaseResponse<List<HomeUpcomingInternResponseDto>> =
override suspend fun getUpcomingIntern(): BaseResponse<HomeUpcomingInternResponseDto> =
homeService.getHomeUpcomingIntern()

override suspend fun getRecommendIntern(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ import kotlinx.serialization.Serializable

@Serializable
data class HomeUpcomingInternResponseDto(
@SerialName("internshipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("companyImage")
val companyImage: String,
@SerialName("title")
val title: String,
@SerialName("dDay")
val dDay: String,
@SerialName("deadline")
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
@SerialName("color")
val color: String,
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("companyInfo")
val companyInfo: String,
)
@SerialName("hasScrapped")
val hasScrapped: Boolean,
@SerialName("scraps")
val scraps: List<HomeUpcomingInternList>,
) {
@Serializable
data class HomeUpcomingInternList(
@SerialName("internshipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("companyImage")
val companyImage: String,
@SerialName("title")
val title: String,
@SerialName("dDay")
val dDay: String,
@SerialName("deadline")
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
@SerialName("color")
val color: String,
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("companyInfo")
val companyInfo: String,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import com.terning.domain.entity.home.HomeUpcomingIntern

fun HomeUpcomingInternResponseDto.toHomeUpcomingInternList(): HomeUpcomingIntern =
HomeUpcomingIntern(
hasScrapped = this.hasScrapped,
homeUpcomingInternDetail = this.scraps.map {
it.toHomeUpcomingInternDetail()
},
)

fun HomeUpcomingInternResponseDto.HomeUpcomingInternList.toHomeUpcomingInternDetail(): HomeUpcomingIntern.HomeUpcomingInternDetail =
HomeUpcomingIntern.HomeUpcomingInternDetail(
internshipAnnouncementId = this.internshipAnnouncementId,
companyImage = this.companyImage,
title = this.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ import javax.inject.Inject
class HomeRepositoryImpl @Inject constructor(
private val homeDataSource: HomeDataSource,
) : HomeRepository {
override suspend fun getHomeUpcomingInternList(): Result<List<HomeUpcomingIntern>> =
override suspend fun getHomeUpcomingInternList(): Result<HomeUpcomingIntern> =
runCatching {
homeDataSource.getUpcomingIntern().result.map { homeTodayInternResponseDto ->
homeTodayInternResponseDto.toHomeUpcomingInternList()
}
homeDataSource.getUpcomingIntern().result.toHomeUpcomingInternList()
}

override suspend fun getRecommendIntern(
Expand Down
2 changes: 1 addition & 1 deletion data/src/main/java/com/terning/data/service/HomeService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import retrofit2.http.Query

interface HomeService {
@GET("api/v1/home/upcoming")
suspend fun getHomeUpcomingIntern(): BaseResponse<List<HomeUpcomingInternResponseDto>>
suspend fun getHomeUpcomingIntern(): BaseResponse<HomeUpcomingInternResponseDto>

@GET("api/v1/home")
suspend fun getRecommendIntern(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package com.terning.domain.entity.home

data class HomeUpcomingIntern(
val internshipAnnouncementId: Long,
val companyImage: String,
val title: String,
val dDay: String,
val deadline: String,
val workingPeriod: String,
val isScrapped: Boolean,
val color: String,
val startYearMonth: String,
val companyInfo: String,
)
val hasScrapped: Boolean,
val homeUpcomingInternDetail: List<HomeUpcomingInternDetail>
) {
data class HomeUpcomingInternDetail(
val internshipAnnouncementId: Long,
val companyImage: String,
val title: String,
val dDay: String,
val deadline: String,
val workingPeriod: String,
val isScrapped: Boolean,
val color: String,
val startYearMonth: String,
val companyInfo: String,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.terning.domain.entity.home.HomeUpcomingIntern
import com.terning.domain.entity.request.ChangeFilteringRequestModel

interface HomeRepository {
suspend fun getHomeUpcomingInternList(): Result<List<HomeUpcomingIntern>>
suspend fun getHomeUpcomingInternList(): Result<HomeUpcomingIntern>

suspend fun getRecommendIntern(
sortBy: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.navigation.compose.composable
import androidx.navigation.navOptions
import com.terning.core.navigation.Route
import com.terning.feature.filtering.starthome.StartHomeRoute
import com.terning.feature.home.home.navigation.navigateHome
import com.terning.feature.home.navigation.navigateHome
import kotlinx.serialization.Serializable

fun NavController.navigateStartHome(navOptions: NavOptions? = null) {
Expand Down
Loading

0 comments on commit a247ff1

Please sign in to comment.