Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rudeh2926 committed Nov 11, 2024
1 parent ed148b1 commit 8587d96
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@ class NoticePersistenceAdapter(
override fun deleteById(id: UUID) = noticeRepository.deleteById(id)

override fun findByToday(): List<Notice> {
val today = LocalDateTime.now(ZoneId.of("Asia/Seoul"))

return jpaQueryFactory
.selectFrom(QNoticeJpaEntity.noticeJpaEntity)
.where(
QNoticeJpaEntity.noticeJpaEntity.createAt.year().eq(today.year)
.and(QNoticeJpaEntity.noticeJpaEntity.createAt.month().eq(today.monthValue))
.and(QNoticeJpaEntity.noticeJpaEntity.createAt.dayOfMonth().eq(today.dayOfMonth))
)
.orderBy(QNoticeJpaEntity.noticeJpaEntity.createAt.desc())
.limit(5)
.fetch()
.map { noticeMapper.toDomain(it) }
.sortedByDescending { it.createAt }
}

override fun findAll() =
Expand Down

0 comments on commit 8587d96

Please sign in to comment.