Skip to content

Commit

Permalink
πŸ› οΈ 곡지 검색 속도 κ°œμ„ μ„ μœ„ν•œ API μˆ˜μ • 반영 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
moondev03 authored Oct 13, 2024
1 parent 014b427 commit c673039
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import com.neverland.data.remote.model.PageableResponse
import com.neverland.data.remote.model.notice.CommonNoticeDTO
import com.neverland.data.remote.model.notice.JobTrainingNoticeDTO
import com.neverland.data.remote.model.notice.SearchNoticeResultDTO
import com.neverland.domain.enums.NoticeType
import retrofit2.Response

interface NoticeDataSource {
suspend fun searchNotices(
keyword: String,
ssaId: String
ssaId: String,
noticeType: String
): Response<BaseResponse<SearchNoticeResultDTO>>

suspend fun getRecentNotices(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ class NoticeDataSourceImpl @Inject constructor(
): NoticeDataSource {
override suspend fun searchNotices(
keyword: String,
ssaId: String
ssaId: String,
noticeType: String
): Response<BaseResponse<SearchNoticeResultDTO>> {
return service.searchNotices(keyword = keyword, ssaId = ssaId)
return service.searchNotices(keyword = keyword, ssaId = ssaId, noticeType = noticeType)
}

override suspend fun getRecentNotices(ssaId: String): Response<BaseResponse<SearchNoticeResultDTO>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.neverland.data.remote.model.PageableResponse
import com.neverland.data.remote.model.notice.CommonNoticeDTO
import com.neverland.data.remote.model.notice.JobTrainingNoticeDTO
import com.neverland.data.remote.model.notice.SearchNoticeResultDTO
import com.neverland.domain.enums.NoticeType
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query
Expand All @@ -14,7 +15,8 @@ interface NoticeService {
@GET("/api/notices/search")
suspend fun searchNotices(
@Query("keyword") keyword: String,
@Query("ssaid") ssaId: String
@Query("ssaid") ssaId: String,
@Query("noticeType") noticeType: String
): Response<BaseResponse<SearchNoticeResultDTO>>

@GET("/api/notices/recent")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class NoticeRepositoryImpl @Inject constructor(
ssaId: String
): Result<List<NoticeItem>> {
return handleResponse(
call = { datasource.searchNotices(keyword = keyword, ssaId = ssaId) },
call = { datasource.searchNotices(keyword = keyword, ssaId = ssaId, noticeType = noticeType.enName) },
onSuccess = { data ->
val notices = when (noticeType) {
NoticeType.NORMAL_NOTICE -> data?.normalNotices
Expand Down Expand Up @@ -507,7 +507,7 @@ class NoticeRepositoryImpl @Inject constructor(
ssaId: String
): Result<AllNotices> {
return handleResponse(
call = { datasource.searchNotices(keyword = keyword, ssaId = ssaId) },
call = { datasource.searchNotices(keyword = keyword, ssaId = ssaId, noticeType = "AllNotice") },
onSuccess = { data ->
AllNotices(
safetyNotice = data!!.safetyNotices?.map {
Expand Down

0 comments on commit c673039

Please sign in to comment.