From d5dc781dfa5173c13fd8c0be0f20c927cb5f4edb Mon Sep 17 00:00:00 2001 From: saewoo1 Date: Fri, 11 Oct 2024 14:51:15 +0900 Subject: [PATCH] =?UTF-8?q?[BE]=20FIX:=20=EB=93=B1=EB=A1=9D=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=20=EB=82=A0=EC=A7=9C=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C?= =?UTF-8?q?=20=ED=95=B4=EB=8B=B9=20=EC=9B=94=EC=9D=98=20=EC=B2=AB=20?= =?UTF-8?q?=EB=82=A0=20=EC=9E=90=EC=A0=95=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존 시간설정을 하지 않아 조회 당일 기준보다 이전의 폼을 반환하지 않는 오류 수정 --- .../presentation/service/PresentationService.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/org/ftclub/cabinet/presentation/service/PresentationService.java b/backend/src/main/java/org/ftclub/cabinet/presentation/service/PresentationService.java index 69e3629df..963918876 100644 --- a/backend/src/main/java/org/ftclub/cabinet/presentation/service/PresentationService.java +++ b/backend/src/main/java/org/ftclub/cabinet/presentation/service/PresentationService.java @@ -41,7 +41,7 @@ @Transactional(readOnly = true) public class PresentationService { - private static final Integer START_DAY = 1; + private static final Integer PRESENTATION_PERIOD = 3; private static final Integer DEFAULT_PAGE = 0; // 쿼리로 받? private static final Integer MAX_MONTH = 3; @@ -285,9 +285,10 @@ public void generatePresentationFormsEveryThreeMonth(LocalDate nowDate) { } public AbleDateResponseDto getAbleDate() { - LocalDateTime now = LocalDateTime.now(); + LocalDateTime firstDateOfMonth = generateFirstLocalDateTime(); List dummyDates = - presentationQueryService.getDummyDateBetweenMonth(now, now.plusMonths(3)); + presentationQueryService.getDummyDateBetweenMonth(firstDateOfMonth, + firstDateOfMonth.plusMonths(PRESENTATION_PERIOD)); List result = dummyDates.stream() @@ -296,4 +297,12 @@ public AbleDateResponseDto getAbleDate() { return new AbleDateResponseDto(result); } + + private LocalDateTime generateFirstLocalDateTime() { + return LocalDateTime.now() + .withDayOfMonth(1) + .withHour(0) + .withMinute(0) + .withSecond(0); + } }