Skip to content

Commit

Permalink
merge: (#224) 휴무 조회 파라미터 변경 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 authored Dec 16, 2022
2 parents 3fbd934 + de55199 commit 39af80a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 26 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ CommitType: (#IssueNumber) Subject

### CommitTypes

|CommitType|Description|
|:--------:|:---------:|
| add | 파일을 추가하는 작업 |
| feat | 기존의 파일에 기능을 추가하는 작업 |
| ci | ci 구성 파일 및 스크립트 변경 |
| chore | 패키지 생성 및 변경 |
| refactor | 기존의 기능을 벗어나지 않고 코드를 변경하는 작업 |
| docs | 문서 작성 및 변경 |
|CommitType| Description |
|:--------:|:--------------------------------:|
| add | 파일을 추가하는 작업 |
| feat | 기존의 파일에 기능을 추가하는 작업 |
| ci | ci 구성 파일 및 스크립트 변경 |
| chore | 패키지 생성 및 변경, 간단한 작업 |
| refactor | 기존의 기능을 벗어나지 않고 코드를 변경하는 작업 |
| docs | 문서 작성 및 변경 |
| style | 클래스 명, 메소드 명 등 코드에 영향을 주지않는 변경사항 |
| build | 시스템 또는 외부 종속성에 영향을 끼치는 작업 |
| fix | 버그 수정 |
| test | 테스트 케이스 작성 및 수정 |
| revert | 작업 되돌리기 |
| perf | 성능 개선 |
| hotfix | 매우 급한 작업 |
| build | 시스템 또는 외부 종속성에 영향을 끼치는 작업 |
| fix | 버그 수정 |
| test | 테스트 케이스 작성 및 수정 |
| revert | 작업 되돌리기 |
| perf | 성능 개선 |
| hotfix | 매우 급한 작업 |

### IssueNumber

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ class QueryIndividualHolidayUseCase(
private val securityPort: HolidaySecurityPort
) {

fun execute(date: LocalDate) : QueryIndividualHolidaysResponse {
fun execute(
startAt: LocalDate,
endAt: LocalDate
) : QueryIndividualHolidaysResponse {
val currentUserId = securityPort.getCurrentUserId()

val holidays = queryHolidayPort.queryHolidaysByMonthAndUserId(date, currentUserId)
val holidays = queryHolidayPort.queryHolidaysByPeriodAndUserId(startAt, endAt, currentUserId)

val response = holidays.map {
IndividualHolidayResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ class QueryIndividualHolidayUseCaseTests {
given(securityPort.getCurrentUserId())
.willReturn(userId)

given(queryHolidayPort.queryHolidaysByMonthAndUserId(dateStub, userId))
given(queryHolidayPort.queryHolidaysByPeriodAndUserId(dateStub, dateStub, userId))
.willReturn(holidaysStub)

// when
val response = queryIndividualHolidayUseCase.execute(dateStub)
val response = queryIndividualHolidayUseCase.execute(dateStub, dateStub)

// then
assertEquals(response, responseStub)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ interface QueryHolidayPort {

fun queryHolidayByDateAndUserId(date: LocalDate, userId: UUID) : Holiday?

fun queryHolidaysByMonthAndUserId(date: LocalDate, userId: UUID) : List<Holiday>
fun queryHolidaysByPeriodAndUserId(startAt: LocalDate, endAt: LocalDate, userId: UUID) : List<Holiday>

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object QuerydslExtensionUtils {
/**
* 입력된 날짜가 포함된 달
*/
fun DatePath<LocalDate>.sameMonthFilter(date: LocalDate): BooleanExpression {
fun DatePath<LocalDate>.sameMonthFilter(date: LocalDate) : BooleanExpression {
val startOfMonth = date.withDayOfMonth(1)
val endOfMonth = date.withDayOfMonth(date.lengthOfMonth())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.springframework.stereotype.Component
import team.comit.simtong.domain.holiday.model.Holiday
import team.comit.simtong.domain.holiday.model.HolidayType
import team.comit.simtong.domain.holiday.spi.HolidayPort
import team.comit.simtong.persistence.QuerydslExtensionUtils.sameMonthFilter
import team.comit.simtong.persistence.QuerydslExtensionUtils.sameWeekFilter
import team.comit.simtong.persistence.holiday.entity.HolidayId
import team.comit.simtong.persistence.holiday.mapper.HolidayMapper
Expand Down Expand Up @@ -49,11 +48,11 @@ class HolidayPersistenceAdapter(
).let(holidayMapper::toDomain)
}

override fun queryHolidaysByMonthAndUserId(date: LocalDate, userId: UUID): List<Holiday> {
override fun queryHolidaysByPeriodAndUserId(startAt: LocalDate, endAt: LocalDate, userId: UUID): List<Holiday> {
return queryFactory.selectFrom(holiday)
.where(
holiday.id.userId.eq(userId),
holiday.id.date.sameMonthFilter(date)
holiday.id.date.between(startAt, endAt)
)
.orderBy(holiday.id.date.asc())
.fetch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class WebHolidayAdapter(
}

@GetMapping
fun queryIndividualHolidays(@RequestParam date: LocalDate) : QueryIndividualHolidaysResponse {
return queryIndividualHolidayUseCase.execute(date)
fun queryIndividualHolidays(
@RequestParam startAt: LocalDate,
@RequestParam endAt: LocalDate
) : QueryIndividualHolidaysResponse {
return queryIndividualHolidayUseCase.execute(startAt, endAt)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class WebScheduleAdapter(
}

@GetMapping("/spots")
fun entireSpotSchedule(@RequestParam date: LocalDate): QueryEntireSpotScheduleResponse {
fun queryEntireSpotSchedule(@RequestParam date: LocalDate): QueryEntireSpotScheduleResponse {
return queryEntireSpotScheduleUseCase.execute(date)
}

Expand Down

0 comments on commit 39af80a

Please sign in to comment.