Skip to content

Commit

Permalink
[fix] : gallery 조회 job -> BOOKMARK 및 조회 인자 uppercase로 변경 (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb authored Mar 7, 2024
1 parent e607a38 commit 650a15f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gallery/src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class GalleryGetApp(
}

private fun getPage(page: Int, count: Int, orderType: String): Pageable {
return when (orderType.lowercase()) {
"update" -> PageRequest.of(page, count, Sort.by("updateOrder").descending())
"job" -> PageRequest.of(page, count, Sort.by("survey.bookmarkedCount").descending())
return when (orderType.uppercase()) {
"UPDATE" -> PageRequest.of(page, count, Sort.by("updateOrder").descending())
"BOOKMARK" -> PageRequest.of(page, count, Sort.by("survey.bookmarkedCount").descending())
else -> throw IllegalArgumentException("orderType 은 update와 bookmark중 하나여야 합니다. 현재 orderType \"$orderType\"")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class GalleryController(
@GetMapping
@ResponseStatus(HttpStatus.OK)
fun getGalleries(
@RequestParam(name = "job", defaultValue = "all") job: String,
@RequestParam(name = "job", defaultValue = "ALL") job: String,
@RequestParam(name = "page", defaultValue = "0") page: Int,
@RequestParam(name = "count", defaultValue = "5") count: Int,
@RequestParam(name = "order-type", defaultValue = "update") orderType: String
@RequestParam(name = "order-type", defaultValue = "UPDATE") orderType: String
): GalleriesDto {
return galleryGetApp.getGalleries(job, page, count, orderType)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class GalleryService(
}

fun getGalleries(job: String, pageable: Pageable): Page<Gallery> {
val jobs = when (job) {
"all" -> Job.entries.toList()
val jobs = when (job.uppercase()) {
"ALL" -> Job.entries.toList()
else -> listOf(Job.valueOf(job.uppercase()))
}

Expand Down

0 comments on commit 650a15f

Please sign in to comment.