-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
.../src/main/kotlin/team/comit/simtong/domain/holiday/dto/QueryIndividualHolidaysResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
) | ||
|
||
/** | ||
* | ||
* 개인 휴무일 정보를 전송하는 IndividualHolidayResponse | ||
* | ||
* @author Chokyunghyeon | ||
* @date 2022/12/05 | ||
* @version 1.0.0 | ||
**/ | ||
data class IndividualHolidayResponse( | ||
val date: LocalDate, | ||
val type: String | ||
) |
39 changes: 39 additions & 0 deletions
39
...rc/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryIndividualHolidayUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
|
||
} |