From 7d94d654e6b8827a0962ad6106f071ba60eefa1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98jminkkk=E2=80=99?= <102847513+jminkkk@users.noreply.github.com> Date: Mon, 30 Dec 2024 16:34:03 +0900 Subject: [PATCH] =?UTF-8?q?refactor(controller):=20=EC=83=81=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/codezap/tag/controller/TagController.java | 2 +- backend/src/main/java/codezap/tag/service/TagService.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/codezap/tag/controller/TagController.java b/backend/src/main/java/codezap/tag/controller/TagController.java index ca94a3913..cf3b7e5d8 100644 --- a/backend/src/main/java/codezap/tag/controller/TagController.java +++ b/backend/src/main/java/codezap/tag/controller/TagController.java @@ -26,7 +26,7 @@ public ResponseEntity getTags(@RequestParam Long memberId) } @GetMapping("/top") - public ResponseEntity getTopTags(@RequestParam(defaultValue = "10") int size) { + public ResponseEntity getTopTags(@RequestParam(defaultValue = DEFAULT_TOP_TAG_COUNT) int size) { FindAllTagsResponse response = tagService.getTopTags(size); return ResponseEntity.ok(response); } diff --git a/backend/src/main/java/codezap/tag/service/TagService.java b/backend/src/main/java/codezap/tag/service/TagService.java index 32e9518b3..2ce3bec59 100644 --- a/backend/src/main/java/codezap/tag/service/TagService.java +++ b/backend/src/main/java/codezap/tag/service/TagService.java @@ -21,6 +21,7 @@ @Transactional(readOnly = true) public class TagService { + private static final int DEFAULT_POPULAR_DATE_RANGE = 7; private final TagRepository tagRepository; private final TemplateTagRepository templateTagRepository; @@ -89,7 +90,7 @@ public FindAllTagsResponse getTopTags(int size) { } private List findTopTags(int size, LocalDate startDate) { - List tags = tagRepository.findMostUsedTagsWithinDateRange(size, startDate.minusDays(7)); + List tags = tagRepository.findMostUsedTagsWithinDateRange(size, startDate.minusDays(DEFAULT_POPULAR_DATE_RANGE)); if (tags.size() >= size) { return tags;