From be3438df29b50da4eaf2076c2e7ee649421bc4a5 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sun, 12 Feb 2023 01:09:37 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20(#313)=20=EB=82=98=EB=A8=B8=EC=A7=80?= =?UTF-8?q?=20=EC=98=81=EB=AC=B8=20=EB=AA=85=EC=B9=AD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nnualResponse.kt => QueryRestOfAnnualResponse.kt} | 4 ++-- ...nAnnualUseCase.kt => QueryRestOfAnnualUseCase.kt} | 12 ++++++------ ...CaseTests.kt => QueryRestOfAnnualUseCaseTests.kt} | 8 ++++---- .../comit/simtong/domain/holiday/model/Holiday.kt | 2 +- .../simtong/domain/holiday/WebHolidayAdapter.kt | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) rename simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/{QueryRemainAnnualResponse.kt => QueryRestOfAnnualResponse.kt} (61%) rename simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/{QueryRemainAnnualUseCase.kt => QueryRestOfAnnualUseCase.kt} (70%) rename simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/{QueryRemainAnnualUseCaseTests.kt => QueryRestOfAnnualUseCaseTests.kt} (85%) diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRemainAnnualResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRestOfAnnualResponse.kt similarity index 61% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRemainAnnualResponse.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRestOfAnnualResponse.kt index b1b37721..e1ca7677 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRemainAnnualResponse.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/dto/response/QueryRestOfAnnualResponse.kt @@ -2,12 +2,12 @@ package team.comit.simtong.domain.holiday.dto.response /** * - * 남은 연차 개수를 전송하는 QueryRemainAnnualWebResponse + * 남은 연차 개수를 전송하는 QueryRestOfAnnualWebResponse * * @author Chokyunghyeon * @date 2022/12/20 * @version 1.0.0 **/ -data class QueryRemainAnnualResponse( +data class QueryRestOfAnnualResponse( val result: Long ) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCase.kt similarity index 70% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCase.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCase.kt index fca91ecf..43a952d4 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCase.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.holiday.usecase -import team.comit.simtong.domain.holiday.dto.response.QueryRemainAnnualResponse +import team.comit.simtong.domain.holiday.dto.response.QueryRestOfAnnualResponse import team.comit.simtong.domain.holiday.model.Holiday import team.comit.simtong.domain.holiday.model.HolidayType import team.comit.simtong.domain.holiday.spi.HolidaySecurityPort @@ -9,7 +9,7 @@ import team.comit.simtong.global.annotation.ReadOnlyUseCase /** * - * 남은 연차 개수 확인을 담당하는 QueryRemainAnnualUseCase + * 남은 연차 개수 확인을 담당하는 QueryRestOfAnnualUseCase * * @author Chokyunghyeon * @author kimbeomjin @@ -17,18 +17,18 @@ import team.comit.simtong.global.annotation.ReadOnlyUseCase * @version 1.2.5 **/ @ReadOnlyUseCase -class QueryRemainAnnualUseCase( +class QueryRestOfAnnualUseCase( private val queryHolidayPort: QueryHolidayPort, private val securityPort: HolidaySecurityPort ) { - fun execute(year: Int): QueryRemainAnnualResponse { + fun execute(year: Int): QueryRestOfAnnualResponse { val currentUserId = securityPort.getCurrentUserId() val annualCount = queryHolidayPort.countHolidayByYearAndUserIdAndType(year, currentUserId, HolidayType.ANNUAL) return Holiday - .calculateRemainedAnnualCount(annualCount) - .let(::QueryRemainAnnualResponse) + .calculateRestOfAnnualCount(annualCount) + .let(::QueryRestOfAnnualResponse) } } \ No newline at end of file diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCaseTests.kt similarity index 85% rename from simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCaseTests.kt rename to simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCaseTests.kt index f7426757..d9f7fad8 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRemainAnnualUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/holiday/usecase/QueryRestOfAnnualUseCaseTests.kt @@ -13,7 +13,7 @@ import team.comit.simtong.global.annotation.SimtongTest import java.util.UUID @SimtongTest -class QueryRemainAnnualUseCaseTests { +class QueryRestOfAnnualUseCaseTests { @MockBean private lateinit var queryHolidayPort: QueryHolidayPort @@ -21,7 +21,7 @@ class QueryRemainAnnualUseCaseTests { @MockBean private lateinit var securityPort: HolidaySecurityPort - private lateinit var queryRemainAnnualUseCase: QueryRemainAnnualUseCase + private lateinit var queryRestOfAnnualUseCase: QueryRestOfAnnualUseCase private val id: UUID = UUID.randomUUID() @@ -29,7 +29,7 @@ class QueryRemainAnnualUseCaseTests { @BeforeEach fun setUp() { - queryRemainAnnualUseCase = QueryRemainAnnualUseCase(queryHolidayPort, securityPort) + queryRestOfAnnualUseCase = QueryRestOfAnnualUseCase(queryHolidayPort, securityPort) } @Test @@ -44,7 +44,7 @@ class QueryRemainAnnualUseCaseTests { .willReturn(count) // when - val result = queryRemainAnnualUseCase.execute(year) + val result = queryRestOfAnnualUseCase.execute(year) // then assertEquals(result.result, Holiday.ANNUAL_LEAVE_LIMIT - count) diff --git a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/model/Holiday.kt b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/model/Holiday.kt index a5d932be..cbb552f9 100644 --- a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/model/Holiday.kt +++ b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/holiday/model/Holiday.kt @@ -51,7 +51,7 @@ data class Holiday( status: HolidayStatus = HolidayStatus.COMPLETED ) = Holiday(date, userId, type, spotId, status) - fun calculateRemainedAnnualCount(annualCount: Long) = ANNUAL_LEAVE_LIMIT - annualCount + fun calculateRestOfAnnualCount(annualCount: Long) = ANNUAL_LEAVE_LIMIT - annualCount fun checkNotExceededHolidayLimit(holidayCount: Long) { if (holidayCount >= WEEK_HOLIDAY_LIMIT) { 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 f1081aa2..ee9eab85 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 @@ -19,7 +19,7 @@ import team.comit.simtong.domain.holiday.dto.ShareHolidayRequest import team.comit.simtong.domain.holiday.dto.response.QueryEmployeeHolidayResponse import team.comit.simtong.domain.holiday.dto.response.QueryIndividualHolidaysResponse import team.comit.simtong.domain.holiday.dto.response.QueryMonthHolidayPeriodResponse -import team.comit.simtong.domain.holiday.dto.response.QueryRemainAnnualResponse +import team.comit.simtong.domain.holiday.dto.response.QueryRestOfAnnualResponse import team.comit.simtong.domain.holiday.model.HolidayQueryType import team.comit.simtong.domain.holiday.model.HolidayStatus import team.comit.simtong.domain.holiday.usecase.AppointAnnualUseCase @@ -31,7 +31,7 @@ import team.comit.simtong.domain.holiday.usecase.CheckHolidayPeriodUseCase import team.comit.simtong.domain.holiday.usecase.QueryEmployeeHolidayUseCase import team.comit.simtong.domain.holiday.usecase.QueryIndividualHolidayUseCase import team.comit.simtong.domain.holiday.usecase.QueryMonthHolidayPeriodUseCase -import team.comit.simtong.domain.holiday.usecase.QueryRemainAnnualUseCase +import team.comit.simtong.domain.holiday.usecase.QueryRestOfAnnualUseCase import team.comit.simtong.domain.holiday.usecase.ShareHolidayUseCase import java.time.LocalDate import java.util.UUID @@ -54,7 +54,7 @@ class WebHolidayAdapter( private val queryMonthHolidayPeriodUseCase: QueryMonthHolidayPeriodUseCase, private val appointHolidayPeriodUseCase: AppointHolidayPeriodUseCase, private val checkHolidayPeriodUseCase: CheckHolidayPeriodUseCase, - private val queryRemainAnnualUseCase: QueryRemainAnnualUseCase, + private val queryRestOfAnnualUseCase: QueryRestOfAnnualUseCase, private val appointAnnualUseCase: AppointAnnualUseCase, private val appointHolidayUseCase: AppointHolidayUseCase, private val cancelHolidayUseCase: CancelHolidayUseCase, @@ -65,8 +65,8 @@ class WebHolidayAdapter( ) { @GetMapping("/annual/count") - fun queryRemainAnnual(@NotNull @RequestParam year: Int?): QueryRemainAnnualResponse { - return queryRemainAnnualUseCase.execute(year!!) + fun queryRestOfAnnual(@NotNull @RequestParam year: Int?): QueryRestOfAnnualResponse { + return queryRestOfAnnualUseCase.execute(year!!) } @PostMapping("/annual")