Skip to content

Commit

Permalink
[MERGE] develop -> #183
Browse files Browse the repository at this point in the history
  • Loading branch information
boiledEgg-s committed Aug 28, 2024
2 parents 828055c + ba1d966 commit d33f017
Show file tree
Hide file tree
Showing 22 changed files with 124 additions and 120 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ dependencies {
implementation(libs.ossLicense)
implementation(libs.process.phoenix)

debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
// Compose Preview
implementation(libs.compose.ui.tooling)

// KakaoDependencies
implementation(libs.kakao.user)
Expand Down
3 changes: 1 addition & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ dependencies {
implementation(libs.androidx.material3.android)

// Compose Preview
debugImplementation(libs.compose.ui.tooling)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.compose.ui.tooling)

// Test Dependency
testImplementation(libs.junit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.data.dto.response

import com.terning.domain.entity.response.HomeFilteringInfoModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -14,12 +13,4 @@ data class HomeFilteringInfoResponseDto(
val startYear: Int?,
@SerialName("startMonth")
val startMonth: Int?,
) {
fun toHomeFilteringInfoModel(): HomeFilteringInfoModel =
HomeFilteringInfoModel(
grade = this.grade,
workingPeriod = this.workingPeriod,
startYear = this.startYear,
startMonth = this.startMonth,
)
}
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.data.dto.response

import com.terning.domain.entity.response.HomeRecommendInternModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -24,17 +23,4 @@ data class HomeRecommendInternResponseDto(
val companyImage: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
) {
fun toRecommendInternEntity(): HomeRecommendInternModel =
HomeRecommendInternModel(
scrapId = this.scrapId,
internshipAnnouncementId = this.internshipAnnouncementId,
title = this.title,
dDay = this.dDay,
deadline = deadline,
workingPeriod = this.workingPeriod,
startYearMonth = this.startYearMonth,
companyImage = this.companyImage,
isScrapped = this.isScrapped,
)
}
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.data.dto.response

import com.terning.domain.entity.response.HomeTodayInternModel
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -25,17 +24,4 @@ data class HomeTodayInternResponseDto(
@SerialName("startYearMonth")
val startYearMonth: String,

) {
fun toHomeTodayInternList(): HomeTodayInternModel =
HomeTodayInternModel(
scrapId = this.scrapId,
internshipAnnouncementId = this.internshipAnnouncementId,
companyImage = this.companyImage,
title = this.title,
dDay = this.dDay,
deadline = this.deadline,
workingPeriod = this.workingPeriod,
startYearMonth = this.startYearMonth,
color = this.color,
)
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.terning.data.mapper.home

import com.terning.data.dto.response.HomeFilteringInfoResponseDto
import com.terning.domain.entity.home.HomeFilteringInfo

fun HomeFilteringInfoResponseDto.toHomeFilteringInfo(): HomeFilteringInfo =
HomeFilteringInfo(
grade = this.grade,
workingPeriod = this.workingPeriod,
startYear = this.startYear,
startMonth = this.startMonth,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.terning.data.mapper.home

import com.terning.data.dto.response.HomeRecommendInternResponseDto
import com.terning.domain.entity.home.HomeRecommendIntern

fun HomeRecommendInternResponseDto.toHomeRecommendInternList(): HomeRecommendIntern =
HomeRecommendIntern(
scrapId = this.scrapId,
internshipAnnouncementId = this.internshipAnnouncementId,
title = this.title,
dDay = this.dDay,
deadline = deadline,
workingPeriod = this.workingPeriod,
startYearMonth = this.startYearMonth,
companyImage = this.companyImage,
isScrapped = this.isScrapped,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.terning.data.mapper.home

import com.terning.data.dto.response.HomeTodayInternResponseDto
import com.terning.domain.entity.home.HomeTodayIntern

fun HomeTodayInternResponseDto.toHomeTodayInternList(): HomeTodayIntern =
HomeTodayIntern(
scrapId = this.scrapId,
internshipAnnouncementId = this.internshipAnnouncementId,
companyImage = this.companyImage,
title = this.title,
dDay = this.dDay,
deadline = this.deadline,
workingPeriod = this.workingPeriod,
startYearMonth = this.startYearMonth,
color = this.color,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,44 @@ package com.terning.data.repositoryimpl

import com.terning.data.datasource.HomeDataSource
import com.terning.data.dto.request.toChangeFilterRequestDto
import com.terning.data.mapper.home.toHomeFilteringInfo
import com.terning.data.mapper.home.toHomeRecommendInternList
import com.terning.data.mapper.home.toHomeTodayInternList
import com.terning.domain.entity.home.HomeFilteringInfo
import com.terning.domain.entity.home.HomeRecommendIntern
import com.terning.domain.entity.home.HomeTodayIntern
import com.terning.domain.entity.request.ChangeFilteringRequestModel
import com.terning.domain.entity.response.HomeFilteringInfoModel
import com.terning.domain.entity.response.HomeRecommendInternModel
import com.terning.domain.entity.response.HomeTodayInternModel
import com.terning.domain.repository.HomeRepository
import javax.inject.Inject

class HomeRepositoryImpl @Inject constructor(
private val homeDataSource: HomeDataSource,
) : HomeRepository {
override suspend fun getHomeTodayInternList(): Result<List<HomeTodayInternModel>> =
override suspend fun getHomeTodayInternList(): Result<List<HomeTodayIntern>> =
runCatching {
homeDataSource.getTodayIntern().result.map {
it.toHomeTodayInternList()
homeDataSource.getTodayIntern().result.map { homeTodayInternResponseDto ->
homeTodayInternResponseDto.toHomeTodayInternList()
}
}

override suspend fun getRecommendIntern(
sortBy: String,
startYear: Int,
startMonth: Int
): Result<List<HomeRecommendInternModel>> =
): Result<List<HomeRecommendIntern>> =
runCatching {
homeDataSource.getRecommendIntern(
sortBy = sortBy,
startYear = startYear,
startMonth = startMonth
).result.map {
it.toRecommendInternEntity()
).result.map { homeRecommendInternResponseDto ->
homeRecommendInternResponseDto.toHomeRecommendInternList()
}
}

override suspend fun getFilteringInfo(): Result<HomeFilteringInfoModel> =
override suspend fun getFilteringInfo(): Result<HomeFilteringInfo> =
runCatching {
homeDataSource.getFilteringInfo().result.toHomeFilteringInfoModel()
homeDataSource.getFilteringInfo().result.toHomeFilteringInfo()
}

override suspend fun putFilteringInfo(putFilteringRequest: ChangeFilteringRequestModel): Result<Unit> =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.domain.entity.response
package com.terning.domain.entity.home

data class HomeFilteringInfoModel(
data class HomeFilteringInfo(
val grade: Int?,
val workingPeriod: Int?,
val startYear: Int?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.domain.entity.response
package com.terning.domain.entity.home

data class HomeRecommendInternModel(
data class HomeRecommendIntern(
val scrapId: Long?,
val internshipAnnouncementId: Long,
val title: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.domain.entity.response
package com.terning.domain.entity.home

data class HomeTodayInternModel(
data class HomeTodayIntern(
val scrapId: Long,
val internshipAnnouncementId: Long,
val companyImage: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.terning.domain.repository

import com.terning.domain.entity.home.HomeFilteringInfo
import com.terning.domain.entity.home.HomeRecommendIntern
import com.terning.domain.entity.home.HomeTodayIntern
import com.terning.domain.entity.request.ChangeFilteringRequestModel
import com.terning.domain.entity.response.HomeFilteringInfoModel
import com.terning.domain.entity.response.HomeRecommendInternModel
import com.terning.domain.entity.response.HomeTodayInternModel

interface HomeRepository {
suspend fun getHomeTodayInternList(): Result<List<HomeTodayInternModel>>
suspend fun getHomeTodayInternList(): Result<List<HomeTodayIntern>>

suspend fun getRecommendIntern(
sortBy: String,
startYear: Int,
startMonth: Int
): Result<List<HomeRecommendInternModel>>
): Result<List<HomeRecommendIntern>>

suspend fun getFilteringInfo(): Result<HomeFilteringInfoModel>
suspend fun getFilteringInfo(): Result<HomeFilteringInfo>

suspend fun putFilteringInfo(
putFilteringRequest: ChangeFilteringRequestModel,
Expand Down
2 changes: 1 addition & 1 deletion feature/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ dependencies {
implementation (libs.androidx.browser)

// Compose Preview
debugImplementation(libs.compose.ui.tooling)
implementation(libs.compose.ui.tooling)

// KakaoDependencies
implementation(libs.kakao.user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.toast
import com.terning.core.state.UiState
import com.terning.domain.entity.home.HomeFilteringInfo
import com.terning.domain.entity.request.ChangeFilteringRequestModel
import com.terning.domain.entity.response.HomeFilteringInfoModel
import com.terning.feature.R
import com.terning.feature.home.changefilter.component.ChangeFilteringRadioGroup
import com.terning.feature.home.changefilter.component.FilteringMainTitleText
import com.terning.feature.home.changefilter.component.FilteringSubTitleText
import com.terning.feature.home.changefilter.navigation.navigateChangeFilter
import com.terning.feature.home.home.HomeSideEffect
import com.terning.feature.home.home.HomeViewModel
import com.terning.feature.home.home.navigation.navigateHome

const val MIN_INDEX = 0
const val MAX_WORKING_INDEX = 2
Expand All @@ -53,7 +52,7 @@ fun ChangeFilterRoute(

when (filteringState) {
is UiState.Success -> ChangeFilterScreen(
(filteringState as UiState.Success<HomeFilteringInfoModel>).data,
(filteringState as UiState.Success<HomeFilteringInfo>).data,
navController,
viewModel,
)
Expand All @@ -75,7 +74,7 @@ fun ChangeFilterRoute(

@Composable
fun ChangeFilterScreen(
filterData: HomeFilteringInfoModel,
filterData: HomeFilteringInfo,
navController: NavController,
viewModel: HomeViewModel,
) {
Expand Down
Loading

0 comments on commit d33f017

Please sign in to comment.