Skip to content

Commit

Permalink
feat: Validated, Valid annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
KimDoubleB committed Jun 29, 2024
1 parent c5b079c commit 0eb7139
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.piikii.application.port.input.room.dto.response.RoomSaveResponseForm
import com.piikii.input.http.docs.RoomApiDocs
import com.piikii.input.http.dto.ResponseForm
import com.piikii.input.http.dto.RoomMessage
import jakarta.validation.Valid
import org.springframework.http.HttpStatus
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.DeleteMapping
Expand All @@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.ResponseStatus
import org.springframework.web.bind.annotation.RestController
import java.util.UUID

@Validated
@RestController
@RequestMapping("/v1/rooms")
class RoomApi(
Expand All @@ -29,7 +31,7 @@ class RoomApi(
@ResponseStatus(HttpStatus.CREATED)
@PostMapping
override fun generate(
@Validated @RequestBody request: RoomSaveRequestForm,
@Valid @RequestBody request: RoomSaveRequestForm,
): ResponseForm<RoomSaveResponseForm> {
return ResponseForm(
data = roomUseCase.generate(request),
Expand All @@ -40,7 +42,7 @@ class RoomApi(
@ResponseStatus(HttpStatus.OK)
@PutMapping
override fun modifyInformation(
@Validated @RequestBody request: RoomUpdateRequestForm,
@Valid @RequestBody request: RoomUpdateRequestForm,
): ResponseForm<Unit> {
roomUseCase.modify(request)
return ResponseForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.piikii.input.http.docs.VoteApiDocs
import com.piikii.input.http.dto.ResponseForm
import com.piikii.input.http.dto.request.VoteRequest
import com.piikii.input.http.dto.response.VoteStatusResponse
import jakarta.validation.Valid
import org.springframework.http.HttpStatus
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseStatus
import org.springframework.web.bind.annotation.RestController
import java.util.UUID

@Validated
@RestController
@RequestMapping("/room/{roomId}/votes")
class VoteApi(
Expand All @@ -29,7 +31,7 @@ class VoteApi(
@PatchMapping("/deadline")
override fun changeVoteDeadline(
@PathVariable roomId: UUID,
@Validated @RequestBody request: VoteDeadlineSetRequest,
@Valid @RequestBody request: VoteDeadlineSetRequest,
): ResponseForm<Unit> {
roomUseCase.changeVoteDeadline(roomId, request.password, request.voteDeadline)
return ResponseForm.EMPTY_RESPONSE
Expand Down

0 comments on commit 0eb7139

Please sign in to comment.