-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT/#77] 홈 뷰 / 맞춤 공고 서버 통신 구현 #86
Changes from 11 commits
0a582b5
8da6f01
8ccdc92
37dfa12
fde4350
6b3d8f2
3cf879a
f95c598
d5d7ddd
583faee
e4348f6
ba35b80
4956446
05a686f
60c003a
df56048
c1ccb62
e6d2228
35de310
65a599f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.terning.data.datasource | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.HomeRecommendInternResponseDto | ||
|
||
interface HomeDataSource { | ||
suspend fun getRecommendIntern(sortBy: String): BaseResponse<HomeRecommendInternResponseDto> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.terning.data.datasourceimpl | ||
|
||
import com.terning.data.datasource.HomeDataSource | ||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.HomeRecommendInternResponseDto | ||
import com.terning.data.service.HomeService | ||
import javax.inject.Inject | ||
|
||
class HomeDataSourceImpl @Inject constructor( | ||
private val homeService: HomeService | ||
) : HomeDataSource { | ||
override suspend fun getRecommendIntern(sortBy: String): BaseResponse<HomeRecommendInternResponseDto> = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BaseResponse로 감싸기 참고합니당!! 히 |
||
homeService.getRecommendIntern(sortBy = sortBy) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.terning.data.dto.response | ||
|
||
import com.terning.domain.entity.response.HomeRecommendInternModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class HomeRecommendInternResponseDto( | ||
@SerialName("internshipAnnouncementId") | ||
val internshipAnnouncementId: Long, | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("dDay") | ||
val dDay: String, | ||
@SerialName("workingPeriod") | ||
val workingPeriod: String, | ||
@SerialName("companyImage") | ||
val companyImage: String, | ||
@SerialName("isScrapped") | ||
val isScrapped: Boolean, | ||
) { | ||
fun toRecommendInternEntity(): List<HomeRecommendInternModel> = listOf( | ||
HomeRecommendInternModel( | ||
internshipAnnouncementId = this.internshipAnnouncementId, | ||
title = this.title, | ||
dDay = this.dDay, | ||
workingPeriod = this.workingPeriod, | ||
companyImage = this.companyImage, | ||
isScrapped = this.isScrapped, | ||
) | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.terning.data.repositoryimpl | ||
|
||
import com.terning.data.datasource.HomeDataSource | ||
import com.terning.domain.entity.response.HomeRecommendInternModel | ||
import com.terning.domain.repository.HomeRepository | ||
import javax.inject.Inject | ||
|
||
class HomeRepositoryImpl @Inject constructor( | ||
private val homeDataSource: HomeDataSource, | ||
) : HomeRepository { | ||
override suspend fun getRecommendIntern(sortBy: String): Result<List<HomeRecommendInternModel>> = | ||
runCatching { | ||
homeDataSource.getRecommendIntern(sortBy = sortBy).result.toRecommendInternEntity() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.terning.data.service | ||
|
||
import com.terning.data.dto.BaseResponse | ||
import com.terning.data.dto.response.HomeRecommendInternResponseDto | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface HomeService { | ||
@GET("api/v1/home") | ||
suspend fun getRecommendIntern( | ||
@Query("sortBy") sortBy: String, | ||
): BaseResponse<HomeRecommendInternResponseDto> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 줄바꿈 없애주시면 완벽할것가탕여 ㅎㅎ |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.terning.domain.entity.response | ||
|
||
data class HomeRecommendInternModel( | ||
val internshipAnnouncementId: Long, | ||
val title: String, | ||
val dDay: String, | ||
val workingPeriod: String, | ||
val companyImage: String, | ||
val isScrapped: Boolean, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.terning.domain.repository | ||
|
||
import com.terning.domain.entity.response.HomeRecommendInternModel | ||
|
||
interface HomeRepository { | ||
suspend fun getRecommendIntern(sortBy: String): Result<List<HomeRecommendInternModel>> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.terning.feature.home.home | ||
|
||
import androidx.annotation.StringRes | ||
|
||
sealed class HomeSideEffect { | ||
data class ShowToast(@StringRes val message: Int) : HomeSideEffect() | ||
data object NavigateToChangeFilter : HomeSideEffect() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 우왕...😗 |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API 명세서 확인해봤을땐
BaseResponse
의result
가 직접 리스트를 관리하는 것으로 보여서 이 방식대로 수정해야되지 않나 싶네요,,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하!!! 감사합니다!!