diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/QueryIndividualHolidaysResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/QueryIndividualHolidaysResponse.kt new file mode 100644 index 00000000..e910c200 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/QueryIndividualHolidaysResponse.kt @@ -0,0 +1,28 @@ +package team.comit.simtong.domain.holiday.dto + +import java.time.LocalDate + +/** + * + * 개인 휴무일 정보를 전송하는 QueryIndividualHolidayResponse + * + * @author Chokyunghyeon + * @date 2022/12/05 + * @version 1.0.0 + **/ +data class QueryIndividualHolidaysResponse( + val holidays: List +) + +/** + * + * 개인 휴무일 정보를 전송하는 IndividualHolidayResponse + * + * @author Chokyunghyeon + * @date 2022/12/05 + * @version 1.0.0 + **/ +data class IndividualHolidayResponse( + val date: LocalDate, + val type: String +) \ No newline at end of file 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 new file mode 100644 index 00000000..ab64fdc3 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt @@ -0,0 +1,39 @@ +package team.comit.simtong.domain.holiday.usecase + +import team.comit.simtong.domain.holiday.dto.IndividualHolidayResponse +import team.comit.simtong.domain.holiday.dto.QueryIndividualHolidaysResponse +import team.comit.simtong.domain.holiday.spi.HolidaySecurityPort +import team.comit.simtong.domain.holiday.spi.QueryHolidayPort +import team.comit.simtong.global.annotation.ReadOnlyUseCase +import java.time.LocalDate + +/** + * + * 개인 휴무일 조회 요청을 담당하는 QueryIndividualHolidayUseCase + * + * @author Chokyunghyeon + * @date 2022/12/05 + * @version 1.0.0 + **/ +@ReadOnlyUseCase +class QueryIndividualHolidayUseCase( + private val queryHolidayPort: QueryHolidayPort, + private val securityPort: HolidaySecurityPort +) { + + fun execute(date: LocalDate) : QueryIndividualHolidaysResponse { + val currentUserId = securityPort.getCurrentUserId() + + val holidays = queryHolidayPort.queryHolidaysByMonthAndUserId(date, currentUserId) + + val response = holidays.map { + IndividualHolidayResponse( + date = it.date, + type = it.type.name + ) + } + + return QueryIndividualHolidaysResponse(response) + } + +} \ No newline at end of file