From 5c0454e55762cd6d653e39566c44c1571f4acc15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9A=B0=ED=98=81=EC=A4=80=20=28HyukJoon=20Woo=29?= Date: Sat, 8 Jun 2024 17:04:49 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=EA=B3=B5=EC=A7=80=20=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20FOREIGN=20->=20INTERNATIONAL=20(#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Feat: Add validation for notice search pagesize, pagenum. * Refactor: Refactor Enum.values() to Enum.entries * Refactor: Change FOREIGN -> INTERNATIONAL --- .../wafflestudio/csereal/core/notice/api/NoticeController.kt | 4 ++-- .../csereal/core/notice/database/TagInNoticeEnum.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/notice/api/NoticeController.kt b/src/main/kotlin/com/wafflestudio/csereal/core/notice/api/NoticeController.kt index 94b95a0f..6c27588d 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/notice/api/NoticeController.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/notice/api/NoticeController.kt @@ -28,8 +28,8 @@ class NoticeController( fun searchNotice( @RequestParam(required = false) tag: List?, @RequestParam(required = false) keyword: String?, - @RequestParam(required = false) pageNum: Int?, - @RequestParam(required = false, defaultValue = "20") pageSize: Int, + @RequestParam(required = false) @Positive pageNum: Int?, + @RequestParam(required = false, defaultValue = "20") @Positive pageSize: Int, @RequestParam(required = false, defaultValue = "DATE") sortBy: String, authentication: Authentication? ): ResponseEntity { diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/TagInNoticeEnum.kt b/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/TagInNoticeEnum.kt index 35576755..14c416f7 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/TagInNoticeEnum.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/TagInNoticeEnum.kt @@ -6,10 +6,10 @@ enum class TagInNoticeEnum(val krName: String) { CLASS("수업"), SCHOLARSHIP("장학"), UNDERGRADUATE("학사(학부)"), GRADUATE("학사(대학원)"), MINOR("다전공/전과"), REGISTRATIONS("등록/복학/휴학/재입학"), ADMISSIONS("입학"), GRADUATIONS("졸업"), RECRUIT("채용정보"), STUDENT_EXCHANGE("교환학생/유학"), INNER_EVENTS_PROGRAMS("내부행사/프로그램"), - OUTER_EVENTS_PROGRAMS("외부행사/프로그램"), FOREIGN("foreign"); + OUTER_EVENTS_PROGRAMS("외부행사/프로그램"), INTERNATIONAL("international"); companion object { - private val lookupMap: Map = values().associateBy(TagInNoticeEnum::krName) + private val lookupMap: Map = entries.associateBy(TagInNoticeEnum::krName) fun getTagEnum(t: String): TagInNoticeEnum { return lookupMap[t] ?: throw CserealException.Csereal404("태그를 찾을 수 없습니다: $t")