Skip to content

Commit

Permalink
πŸ”€ :: (#83) νƒ€μž… μˆ˜μ • api λ³€κ²½
Browse files Browse the repository at this point in the history
πŸ”€ :: (#83) νƒ€μž… μˆ˜μ • api λ³€κ²½
  • Loading branch information
jeongho1209 authored Mar 22, 2023
2 parents 47b17b8 + 8c6e642 commit 3ea1d3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -242,6 +242,7 @@ class AdminWebAdapter(
return adminApi.getStudentStatusListByGradeAndClassNum(grade, classNum)
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/type")
fun saveTypeByLocalDate(
@RequestParam
Expand All @@ -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)
}
}

0 comments on commit 3ea1d3a

Please sign in to comment.