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