Skip to content

Commit

Permalink
chore: (#791) 쿼리에 날짜 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
zios0707 committed Oct 18, 2024
1 parent 59b98cd commit 1ca2f3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class GetOutingServiceImpl(
queryOutingApplicationPort.queryAllOutingApplicationVOsBetweenStartAndEnd(name, start, end)

override fun getCurrentOutingApplication(studentId: UUID): CurrentOutingApplicationVO {
return queryOutingApplicationPort.queryCurrentOutingApplicationVO(studentId)
?: throw OutingApplicationNotFoundException
return queryOutingApplicationPort.queryCurrentOutingApplicationVO(
studentId = studentId,
date = LocalDate.now()
) ?: throw OutingApplicationNotFoundException
}

override fun getOutingAvailableTimesByDayOfWeek(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface QueryOutingApplicationPort {

fun queryAllOutingApplicationVOsBetweenStartAndEnd(name: String?, start: LocalDate, end: LocalDate): List<OutingApplicationVO>

fun queryCurrentOutingApplicationVO(studentId: UUID): CurrentOutingApplicationVO?
fun queryCurrentOutingApplicationVO(studentId: UUID, date: LocalDate): CurrentOutingApplicationVO?

fun isApplicant(studentId: UUID): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class OutingApplicationPersistenceAdapter(
)
}

override fun queryCurrentOutingApplicationVO(studentId: UUID): CurrentOutingApplicationVO? {
override fun queryCurrentOutingApplicationVO(studentId: UUID, date: LocalDate): CurrentOutingApplicationVO? {
val studentJpaEntity = QStudentJpaEntity("studentJpaEntity")
val outingCompanionStudentJpaEntity = QStudentJpaEntity("outingCompanionStudentJpaEntity")

Expand All @@ -107,11 +107,13 @@ class OutingApplicationPersistenceAdapter(
.where(
outingCompanionJpaEntity.student.id.eq(studentId),
outingApplicationJpaEntity.student.id.eq(studentJpaEntity.id),
outingApplicationJpaEntity.isReturned.eq(false)
outingApplicationJpaEntity.isReturned.eq(false),
outingApplicationJpaEntity.outingDate.eq(date)
)
.exists()
),
outingApplicationJpaEntity.isReturned.eq(false)
outingApplicationJpaEntity.isReturned.eq(false),
outingApplicationJpaEntity.outingDate.eq(date)
)
.transform(
groupBy(outingApplicationJpaEntity.id)
Expand Down

0 comments on commit 1ca2f3c

Please sign in to comment.