diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/api/AdminApi.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/api/AdminApi.kt index 01c03b5d..96fede19 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/api/AdminApi.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/api/AdminApi.kt @@ -20,5 +20,5 @@ interface AdminApi { fun saveType(date: LocalDate, type: DirectorType) - fun updateType(typeId: UUID, date: LocalDate, type: DirectorType) + fun updateType(date: LocalDate, type: DirectorType) } diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/usecase/AdminUseCase.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/usecase/AdminUseCase.kt index 0ab2e1d7..a4c96cfb 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/usecase/AdminUseCase.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/usecase/AdminUseCase.kt @@ -275,8 +275,9 @@ class AdminUseCase( ) } - override fun updateType(typeId: UUID, date: LocalDate, type: DirectorType) { - val currentType = queryTypeSpi.queryTypeById(typeId) + override fun updateType(date: LocalDate, type: DirectorType) { + val currentType = queryTypeSpi.queryTypeByDate(date) + ?: throw TypeNotFoundException commandTypeSpi.saveType( currentType.changeType(date, type), ) diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt index 8aa7a993..0415a362 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt @@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import java.time.LocalDate -import java.util.* +import java.util.UUID import javax.validation.Valid @RequestMapping("/admin") @@ -242,6 +242,7 @@ class AdminWebAdapter( return adminApi.getStudentStatusListByGradeAndClassNum(grade, classNum) } + @ResponseStatus(HttpStatus.CREATED) @PostMapping("/type") fun saveTypeByLocalDate( @RequestParam @@ -253,16 +254,15 @@ class AdminWebAdapter( adminApi.saveType(date, type) } - @PatchMapping("/type/{type-id}") + @ResponseStatus(HttpStatus.NO_CONTENT) + @PatchMapping("/type") fun updateType( - @PathVariable("type-id") - typeId: UUID, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") date: LocalDate, @RequestParam type: DirectorType, ) { - adminApi.updateType(typeId, date, type) + adminApi.updateType(date, type) } }