diff --git a/README.md b/README.md index 8b7e90b6..e7d8a7f0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt index ab64fdc3..ba9167ad 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt @@ -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( diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCaseTests.kt index c1a0fcaf..2c3afe38 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCaseTests.kt @@ -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) diff --git a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/spi/QueryHolidayPort.kt b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/spi/QueryHolidayPort.kt index 148acf04..0409bfb8 100644 --- a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/spi/QueryHolidayPort.kt +++ b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/spi/QueryHolidayPort.kt @@ -19,6 +19,6 @@ interface QueryHolidayPort { fun queryHolidayByDateAndUserId(date: LocalDate, userId: UUID) : Holiday? - fun queryHolidaysByMonthAndUserId(date: LocalDate, userId: UUID) : List + fun queryHolidaysByPeriodAndUserId(startAt: LocalDate, endAt: LocalDate, userId: UUID) : List } \ No newline at end of file diff --git a/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/QuerydslExtensionUtils.kt b/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/QuerydslExtensionUtils.kt index 106852ce..f0ad1691 100644 --- a/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/QuerydslExtensionUtils.kt +++ b/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/QuerydslExtensionUtils.kt @@ -18,7 +18,7 @@ object QuerydslExtensionUtils { /** * 입력된 날짜가 포함된 달 */ - fun DatePath.sameMonthFilter(date: LocalDate): BooleanExpression { + fun DatePath.sameMonthFilter(date: LocalDate) : BooleanExpression { val startOfMonth = date.withDayOfMonth(1) val endOfMonth = date.withDayOfMonth(date.lengthOfMonth()) diff --git a/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/holiday/HolidayPersistenceAdapter.kt b/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/holiday/HolidayPersistenceAdapter.kt index 63adaa2f..8317ccc3 100644 --- a/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/holiday/HolidayPersistenceAdapter.kt +++ b/simtong-infrastructure/src/main/kotlin/team/comit/simtong/persistence/holiday/HolidayPersistenceAdapter.kt @@ -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 @@ -49,11 +48,11 @@ class HolidayPersistenceAdapter( ).let(holidayMapper::toDomain) } - override fun queryHolidaysByMonthAndUserId(date: LocalDate, userId: UUID): List { + override fun queryHolidaysByPeriodAndUserId(startAt: LocalDate, endAt: LocalDate, userId: UUID): List { 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() diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt index 603ba2f4..64230a18 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/holiday/WebHolidayAdapter.kt @@ -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) } } \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt index 5f9d9802..e21e3f9b 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/schedule/WebScheduleAdapter.kt @@ -90,7 +90,7 @@ class WebScheduleAdapter( } @GetMapping("/spots") - fun entireSpotSchedule(@RequestParam date: LocalDate): QueryEntireSpotScheduleResponse { + fun queryEntireSpotSchedule(@RequestParam date: LocalDate): QueryEntireSpotScheduleResponse { return queryEntireSpotScheduleUseCase.execute(date) }