Skip to content

Commit

Permalink
feat: (#251) 휴무표 작성 기간 설정 API 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Dec 22, 2022
1 parent 34896b0 commit 0301a82
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class SecurityConfig(
.antMatchers(HttpMethod.GET, "/holidays/annual/count").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.GET, "/holidays/verification-period").hasRole(ROLE_COMMON.role)
.antMatchers(HttpMethod.GET, "/holidays/employee").hasRole(ROLE_ADMIN.role)
.antMatchers(HttpMethod.PUT, "/holidays/period").hasRole(ROLE_ADMIN.role)

// admins
.antMatchers(HttpMethod.POST, "/admins/tokens").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.ResponseStatus
import org.springframework.web.bind.annotation.RestController
import team.comit.simtong.domain.holiday.dto.AppointHolidayPeriodRequest
import team.comit.simtong.domain.holiday.dto.QueryEmployeeHolidayResponse
import team.comit.simtong.domain.holiday.dto.QueryIndividualHolidaysResponse
import team.comit.simtong.domain.holiday.dto.QueryIndividualRequest
import team.comit.simtong.domain.holiday.dto.request.AppointAnnualWebRequest
import team.comit.simtong.domain.holiday.dto.request.AppointHolidayPeriodWebRequest
import team.comit.simtong.domain.holiday.dto.request.AppointHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.request.CancelHolidayRequest
import team.comit.simtong.domain.holiday.dto.request.CancelHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.request.ShareHolidayWebRequest
import team.comit.simtong.domain.holiday.dto.request.WebHolidayQueryType
import team.comit.simtong.domain.holiday.dto.request.WebHolidayStatus
import team.comit.simtong.domain.holiday.dto.response.QueryRemainAnnualWebResponse
import team.comit.simtong.domain.holiday.usecase.AppointAnnualUseCase
import team.comit.simtong.domain.holiday.usecase.AppointHolidayPeriodUseCase
import team.comit.simtong.domain.holiday.usecase.AppointHolidayUseCase
import team.comit.simtong.domain.holiday.usecase.CancelHolidayUseCase
import team.comit.simtong.domain.holiday.usecase.CheckHolidayPeriodUseCase
Expand All @@ -42,6 +45,7 @@ import javax.validation.Valid
@RestController
@RequestMapping("/holidays")
class WebHolidayAdapter(
private val appointHolidayPeriodUseCase: AppointHolidayPeriodUseCase,
private val checkHolidayPeriodUseCase: CheckHolidayPeriodUseCase,
private val queryRemainAnnualUseCase: QueryRemainAnnualUseCase,
private val appointAnnualUseCase: AppointAnnualUseCase,
Expand Down Expand Up @@ -72,7 +76,7 @@ class WebHolidayAdapter(
}

@PutMapping("/work")
fun cancelHoliday(@RequestBody request: CancelHolidayRequest) {
fun cancelHoliday(@RequestBody request: CancelHolidayWebRequest) {
cancelHolidayUseCase.execute(request.date)
}

Expand Down Expand Up @@ -119,4 +123,16 @@ class WebHolidayAdapter(
teamId = teamId
)
}

@PutMapping("/period")
fun appointHolidayPeriod(@Valid @RequestBody request: AppointHolidayPeriodWebRequest) {
appointHolidayPeriodUseCase.execute(
AppointHolidayPeriodRequest(
year = request.year,
month = request.month,
startAt = request.startAt,
endAt = request.endAt
)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package team.comit.simtong.domain.holiday.dto.request

import org.hibernate.validator.constraints.Range
import java.time.LocalDate
import javax.validation.constraints.NotNull

/**
*
* 휴무표 작성 기간 설정을 요청하는 AppointHolidayPeriodWebRequest
*
* @author Chokyunghyeon
* @date 2022/12/22
* @version 1.0.0
**/
data class AppointHolidayPeriodWebRequest(
@field:NotNull
val year: Int,

@field:NotNull
@field:Range(
min = 1,
max = 12
)
val month: Int,

val startAt: LocalDate,

val endAt: LocalDate
)

0 comments on commit 0301a82

Please sign in to comment.