diff --git a/gallery/src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt b/gallery/src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt index 4e02e8f0..5df4ff6b 100644 --- a/gallery/src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt +++ b/gallery/src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt @@ -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\"") } } diff --git a/gallery/src/main/kotlin/me/nalab/gallery/controller/GalleryController.kt b/gallery/src/main/kotlin/me/nalab/gallery/controller/GalleryController.kt index be01c988..18c21259 100644 --- a/gallery/src/main/kotlin/me/nalab/gallery/controller/GalleryController.kt +++ b/gallery/src/main/kotlin/me/nalab/gallery/controller/GalleryController.kt @@ -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) } diff --git a/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt b/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt index 78f2610c..595ee76f 100644 --- a/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt +++ b/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt @@ -31,8 +31,8 @@ class GalleryService( } fun getGalleries(job: String, pageable: Pageable): Page { - val jobs = when (job) { - "all" -> Job.entries.toList() + val jobs = when (job.uppercase()) { + "ALL" -> Job.entries.toList() else -> listOf(Job.valueOf(job.uppercase())) }