From 8190c29673fcf1ad40b337070ba31fa24b221c0b Mon Sep 17 00:00:00 2001 From: sookyung kang Date: Sat, 6 Apr 2024 03:53:07 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20fix=20findTodayQuestion?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EC=A0=84=EC=9C=BC=EB=A1=9C=20=20#38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/repository/QuestionRepositoryImpl.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/plu-domain/src/main/kotlin/com/th/plu/domain/domain/question/repository/QuestionRepositoryImpl.kt b/plu-domain/src/main/kotlin/com/th/plu/domain/domain/question/repository/QuestionRepositoryImpl.kt index f4b2fb3..b822288 100644 --- a/plu-domain/src/main/kotlin/com/th/plu/domain/domain/question/repository/QuestionRepositoryImpl.kt +++ b/plu-domain/src/main/kotlin/com/th/plu/domain/domain/question/repository/QuestionRepositoryImpl.kt @@ -7,9 +7,7 @@ import com.th.plu.domain.domain.member.QMember.member import com.th.plu.domain.domain.question.QQuestion.question import com.th.plu.domain.domain.question.Question import org.springframework.stereotype.Repository -import java.time.LocalDate import java.time.LocalDateTime -import java.time.LocalTime import java.time.YearMonth @Repository @@ -74,15 +72,10 @@ class QuestionRepositoryImpl(private val queryFactory: JPAQueryFactory) : Questi } override fun findTodayQuestion(): Question? { - val today = LocalDate.now() - // 오늘 날짜의 시작 시간 - val startOfDay = today.atStartOfDay() - // 오늘 날짜의 마지막 순간 - val endOfDay = today.atTime(LocalTime.MAX) + val today = LocalDateTime.now() return queryFactory .selectFrom(question) - // questionDate가 하루의 시작과 끝 사이에 있는지 확인 - .where(question.questionDate.between(startOfDay, endOfDay)) + .where(question.questionDate.eq(today)) .fetchOne() } -} +} \ No newline at end of file