Skip to content

Commit

Permalink
fix: @Valid 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
eunbc committed Dec 27, 2023
1 parent 776dd03 commit 70659d0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.pgms.apimember.service.RoleService;
import com.pgms.coredomain.response.ApiResponse;

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

@RestController
Expand All @@ -31,7 +32,7 @@ public class RoleController {
private final RoleService roleService;

@PostMapping
public ResponseEntity<ApiResponse<Long>> createRole(@RequestBody RoleCreateRequest request) {
public ResponseEntity<ApiResponse<Long>> createRole(@RequestBody @Valid RoleCreateRequest request) {
final Long roleId = roleService.createRole(request);
final URI uri = ServletUriComponentsBuilder
.fromCurrentRequest()
Expand All @@ -48,7 +49,7 @@ public ResponseEntity<ApiResponse<List<RoleGetResponse>>> getRolesByIds(@Request
}

@PatchMapping("/{id}")
public ResponseEntity<Void> updateRole(@PathVariable Long id, @RequestBody RoleUpdateRequest request) {
public ResponseEntity<Void> updateRole(@PathVariable Long id, @RequestBody @Valid RoleUpdateRequest request) {
roleService.updateRole(id, request);
return ResponseEntity.noContent().build();
}
Expand Down

0 comments on commit 70659d0

Please sign in to comment.