Fix PathVariable type

This commit is contained in:
hou27
2022-06-16 19:36:18 +09:00
parent 07f66e3c34
commit 943b8bc7ff

View File

@@ -25,7 +25,7 @@ public class UserController {
private final UserService userService; private final UserService userService;
@GetMapping("/profile") @GetMapping("/profile")
public ProfileRes profile(@AuthenticationPrincipal UserDetails userDetails) { public ProfileRes profile(@AuthenticationPrincipal UserDetails userDetails) throws UserNotFoundException {
System.out.println("userDetails = " + userDetails); System.out.println("userDetails = " + userDetails);
User userDetail = userService.findByEmail(userDetails.getUsername()) User userDetail = userService.findByEmail(userDetails.getUsername())
.orElseThrow(() -> new UserNotFoundException()); .orElseThrow(() -> new UserNotFoundException());
@@ -37,9 +37,8 @@ public class UserController {
} }
@GetMapping("/profile/user/{username}") @GetMapping("/profile/user/{username}")
public ProfileRes userProfile(@PathVariable ProfileReq username) { public ProfileRes userProfile(@PathVariable String username) throws UserNotFoundException {
System.out.println("username.toString() = " + username.toString()); User user = userService.findByName(username)
User user = userService.findByName(username.getName())
.orElseThrow(UserNotFoundException::new); .orElseThrow(UserNotFoundException::new);
return ProfileRes.builder() return ProfileRes.builder()