From 78c517a3360e156f8107a61c66209f492a78cac0 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 7 Mar 2024 02:07:35 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20gallery=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=EB=A5=BC=20=EC=A0=84=EB=B6=80=20uppercase?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=98=EA=B3=A0,=20job?= =?UTF-8?q?=EC=98=A4=ED=83=80=EB=A5=BC=20BOOKMARK=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/me/nalab/gallery/app/GalleryGetApp.kt | 6 +++--- .../kotlin/me/nalab/gallery/controller/GalleryController.kt | 4 ++-- .../main/kotlin/me/nalab/gallery/domain/GalleryService.kt | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) 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..86c7b2fa 100644 --- a/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt +++ b/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt @@ -31,9 +31,9 @@ class GalleryService( } fun getGalleries(job: String, pageable: Pageable): Page { - val jobs = when (job) { - "all" -> Job.entries.toList() - else -> listOf(Job.valueOf(job.uppercase())) + val jobs = when (job.uppercase()) { + "ALL" -> Job.entries.toList() + else -> listOf(Job.valueOf(job)) } return galleryRepository.findGalleries(jobs, pageable) From 30763d553fbb880a3669a8c198adb346770fb827 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 7 Mar 2024 10:09:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20enum=EC=9D=84=20=EC=B0=BE=EC=9D=84?= =?UTF-8?q?=EB=95=8C=20uppercase=EB=A1=9C=20=EC=B0=BE=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 86c7b2fa..595ee76f 100644 --- a/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt +++ b/gallery/src/main/kotlin/me/nalab/gallery/domain/GalleryService.kt @@ -33,7 +33,7 @@ class GalleryService( fun getGalleries(job: String, pageable: Pageable): Page { val jobs = when (job.uppercase()) { "ALL" -> Job.entries.toList() - else -> listOf(Job.valueOf(job)) + else -> listOf(Job.valueOf(job.uppercase())) } return galleryRepository.findGalleries(jobs, pageable)