Skip to content

Commit f740a39

Browse files
committed
[IDLE-000] 크롤링 공고 커서 페이징에 distance 파라미터 추가
1 parent 2c1f423 commit f740a39

File tree

12 files changed

+76
-47
lines changed

12 files changed

+76
-47
lines changed

core/data/src/main/java/com/idle/data/repository/JobPostingRepositoryImpl.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.idle.domain.model.jobposting.CenterJobPosting
88
import com.idle.domain.model.jobposting.CenterJobPostingDetail
99
import com.idle.domain.model.jobposting.CrawlingJobPosting
1010
import com.idle.domain.model.jobposting.CrawlingJobPostingDetail
11+
import com.idle.domain.model.jobposting.CrawlingJobPostingPage
1112
import com.idle.domain.model.jobposting.DayOfWeek
1213
import com.idle.domain.model.jobposting.JobPostingSummary
1314
import com.idle.domain.model.jobposting.JobPostingType
@@ -17,6 +18,7 @@ import com.idle.domain.model.jobposting.PayType
1718
import com.idle.domain.model.jobposting.SharedJobPostingInfo
1819
import com.idle.domain.model.jobposting.WorkerJobPosting
1920
import com.idle.domain.model.jobposting.WorkerJobPostingDetail
21+
import com.idle.domain.model.jobposting.WorkerJobPostingPage
2022
import com.idle.domain.repositorry.JobPostingRepository
2123
import com.idle.network.model.jobposting.ApplyJobPostingRequest
2224
import com.idle.network.model.jobposting.FavoriteJobPostingRequest
@@ -151,15 +153,15 @@ class JobPostingRepositoryImpl @Inject constructor(
151153
override suspend fun getJobPostings(
152154
next: String?,
153155
limit: Int
154-
): Result<Pair<String?, List<WorkerJobPosting>>> = jobPostingDataSource.getJobPostings(
156+
): Result<WorkerJobPostingPage> = jobPostingDataSource.getJobPostings(
155157
next = next,
156158
limit = limit
157159
).mapCatching { it.toVO() }
158160

159161
override suspend fun getJobPostingsApplied(
160162
next: String?,
161163
limit: Int
162-
): Result<Pair<String?, List<WorkerJobPosting>>> = jobPostingDataSource.getJobPostingsApplied(
164+
): Result<WorkerJobPostingPage> = jobPostingDataSource.getJobPostingsApplied(
163165
next = next,
164166
limit = limit
165167
).mapCatching { it.toVO() }
@@ -213,8 +215,9 @@ class JobPostingRepositoryImpl @Inject constructor(
213215
override suspend fun getCrawlingJobPostings(
214216
next: String?,
215217
limit: Int,
216-
): Result<Pair<String?, List<CrawlingJobPosting>>> =
217-
jobPostingDataSource.getCrawlingJobPostings(next, limit).mapCatching { it.toVO() }
218+
distance: Int,
219+
): Result<CrawlingJobPostingPage> =
220+
jobPostingDataSource.getCrawlingJobPostings(next, limit, distance).mapCatching { it.toVO() }
218221

219222
override suspend fun getCrawlingJobPostingDetail(jobPostingId: String): Result<CrawlingJobPostingDetail> =
220223
jobPostingDataSource.getCrawlingJobPostingsDetail(jobPostingId).mapCatching { it.toVO() }

core/domain/src/main/kotlin/com/idle/domain/model/jobposting/CrawlingJobPosting.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ data class CrawlingJobPosting(
1010
val workingSchedule: String,
1111
val payInfo: String,
1212
val applyDeadline: String,
13-
) : JobPosting(id, distance, jobPostingType, isFavorite)
13+
) : JobPosting(id, distance, jobPostingType, isFavorite)
14+
15+
data class CrawlingJobPostingPage(
16+
val nextCursor: String?,
17+
val items: List<CrawlingJobPosting>,
18+
val nextDistance: Int,
19+
)

core/domain/src/main/kotlin/com/idle/domain/model/jobposting/WorkerJobPosting.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ data class WorkerJobPosting(
2424
val applyDeadline: LocalDate,
2525
val applyTime: LocalDateTime?,
2626
) : JobPosting(id, distance, jobPostingType, isFavorite)
27+
28+
data class WorkerJobPostingPage(
29+
val nextCursor: String?,
30+
val items: List<WorkerJobPosting>,
31+
)

core/domain/src/main/kotlin/com/idle/domain/repositorry/JobPostingRepository.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.idle.domain.model.jobposting.CenterJobPosting
88
import com.idle.domain.model.jobposting.CenterJobPostingDetail
99
import com.idle.domain.model.jobposting.CrawlingJobPosting
1010
import com.idle.domain.model.jobposting.CrawlingJobPostingDetail
11+
import com.idle.domain.model.jobposting.CrawlingJobPostingPage
1112
import com.idle.domain.model.jobposting.DayOfWeek
1213
import com.idle.domain.model.jobposting.JobPostingSummary
1314
import com.idle.domain.model.jobposting.JobPostingType
@@ -17,6 +18,7 @@ import com.idle.domain.model.jobposting.PayType
1718
import com.idle.domain.model.jobposting.SharedJobPostingInfo
1819
import com.idle.domain.model.jobposting.WorkerJobPosting
1920
import com.idle.domain.model.jobposting.WorkerJobPostingDetail
21+
import com.idle.domain.model.jobposting.WorkerJobPostingPage
2022

2123
interface JobPostingRepository {
2224
var sharedJobPostingInfo: SharedJobPostingInfo?
@@ -81,12 +83,12 @@ interface JobPostingRepository {
8183
suspend fun getJobPostings(
8284
next: String?,
8385
limit: Int = 10,
84-
): Result<Pair<String?, List<WorkerJobPosting>>>
86+
): Result<WorkerJobPostingPage>
8587

8688
suspend fun getJobPostingsApplied(
8789
next: String?,
8890
limit: Int = 10,
89-
): Result<Pair<String?, List<WorkerJobPosting>>>
91+
): Result<WorkerJobPostingPage>
9092

9193
suspend fun getMyFavoritesJobPostings(): Result<List<WorkerJobPosting>>
9294

@@ -116,7 +118,8 @@ interface JobPostingRepository {
116118
suspend fun getCrawlingJobPostings(
117119
next: String?,
118120
limit: Int = 10,
119-
): Result<Pair<String?, List<CrawlingJobPosting>>>
121+
distance: Int = 15,
122+
): Result<CrawlingJobPostingPage>
120123

121124
suspend fun getCrawlingJobPostingDetail(jobPostingId: String): Result<CrawlingJobPostingDetail>
122125
}

core/network/src/main/java/com/idle/network/api/JobPostingApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ interface JobPostingApi {
9898
suspend fun getCrawlingJobPostings(
9999
@Query("next") next: String?,
100100
@Query("limit") limit: Int,
101+
@Query("distance") distance: Int,
101102
): Response<GetCrawlingJobPostingsResponse>
102103

103104
@GET("api/v1/crawling-job-postings/{crawling-job-posting-id}")

core/network/src/main/java/com/idle/network/model/jobposting/GetCrawlingJobPostingsResponse.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.idle.network.model.jobposting
22

33
import com.idle.domain.model.jobposting.CrawlingJobPosting
4+
import com.idle.domain.model.jobposting.CrawlingJobPostingPage
45
import com.idle.domain.model.jobposting.JobPostingType
56
import kotlinx.serialization.SerialName
67
import kotlinx.serialization.Serializable
@@ -10,9 +11,13 @@ data class GetCrawlingJobPostingsResponse(
1011
@SerialName("items") val crawlingJobPostingResponses: List<CrawlingJobPostingResponse> = listOf(),
1112
val next: String? = null,
1213
val total: Int = 0,
14+
val nextDistance: Int = 15,
1315
) {
14-
fun toVO(): Pair<String?, List<CrawlingJobPosting>> =
15-
next to crawlingJobPostingResponses.map { it.toVO() }
16+
fun toVO(): CrawlingJobPostingPage = CrawlingJobPostingPage(
17+
nextCursor = next,
18+
items = crawlingJobPostingResponses.map { it.toVO() },
19+
nextDistance = nextDistance,
20+
)
1621
}
1722

1823
@Serializable

core/network/src/main/java/com/idle/network/model/jobposting/GetJobPostingsResponse.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.idle.domain.model.jobposting.DayOfWeek
66
import com.idle.domain.model.jobposting.JobPostingType
77
import com.idle.domain.model.jobposting.PayType
88
import com.idle.domain.model.jobposting.WorkerJobPosting
9+
import com.idle.domain.model.jobposting.WorkerJobPostingPage
910
import kotlinx.serialization.SerialName
1011
import kotlinx.serialization.Serializable
1112
import java.time.LocalDate
@@ -18,8 +19,11 @@ data class GetJobPostingsResponse(
1819
val next: String?,
1920
val total: Int
2021
) {
21-
fun toVO(): Pair<String?, List<WorkerJobPosting>> =
22-
next to workerJobPostingResponses.map { it.toVO() }
22+
fun toVO(): WorkerJobPostingPage =
23+
WorkerJobPostingPage(
24+
nextCursor = next,
25+
items = workerJobPostingResponses.map { it.toVO() },
26+
)
2327
}
2428

2529
@Serializable

core/network/src/main/java/com/idle/network/source/JobPostingDataSource.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ class JobPostingDataSource @Inject constructor(
9393

9494
suspend fun getCrawlingJobPostings(
9595
next: String?,
96-
limit: Int
96+
limit: Int,
97+
distance: Int,
9798
): Result<GetCrawlingJobPostingsResponse> =
98-
safeApiCall { jobPostingApi.getCrawlingJobPostings(next = next, limit = limit) }
99+
safeApiCall { jobPostingApi.getCrawlingJobPostings(next = next, limit = limit, distance = distance) }
99100

100101
suspend fun getCrawlingJobPostingsDetail(
101102
jobPostingId: String

feature/chatting-detail/src/main/java/com/idle/chatting_detail/ui/component/CareChatTextBubble.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ fun CareChatSenderTextBubble(
157157
chatMessage: ChatMessage,
158158
isLast: Boolean,
159159
modifier: Modifier = Modifier,
160-
isRead: Boolean = false,
161160
onSeeAllChatClicked: (String) -> Unit = {},
162161
) {
163162
Row(modifier = modifier.fillMaxWidth()) {
@@ -225,7 +224,7 @@ fun CareChatSenderTextBubble(
225224
.align(Alignment.Bottom)
226225
.padding(start = 6.dp),
227226
) {
228-
if (isRead) {
227+
if (chatMessage.isRead) {
229228
Text(
230229
text = "읽음",
231230
style = CareTheme.typography.caption1,
@@ -248,7 +247,6 @@ fun CareChatReceiverTextBubble(
248247
chatMessage: ChatMessage,
249248
isLast: Boolean,
250249
modifier: Modifier = Modifier,
251-
isRead: Boolean = false,
252250
onSeeAllChatClicked: (String) -> Unit = {},
253251
) {
254252
Row(
@@ -263,7 +261,7 @@ fun CareChatReceiverTextBubble(
263261
.align(Alignment.Bottom)
264262
.padding(end = 6.dp),
265263
) {
266-
if (isRead) {
264+
if (chatMessage.isRead) {
267265
Text(
268266
text = "읽음",
269267
style = CareTheme.typography.caption1,

feature/chatting-detail/src/main/java/com/idle/chatting_detail/ui/component/ChattingBody.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ fun ChattingBody(
106106
CareChatSenderTextBubble(
107107
chatMessage = chatMessage,
108108
isLast = isLast,
109-
isRead = isLast,
110109
onSeeAllChatClicked = { navigateTo(DeepLinkDestination.SeeAllChat(it)) },
111110
modifier = Modifier.padding(itemPadding),
112111
)

0 commit comments

Comments
 (0)