Merge branch 'BE/userinfo' into 'backend'
feat: 회원정보 변경시 이메일 중복 검사 See merge request s11-webmobile1-sub2/S11P12A701!140
This commit is contained in:
commit
7f0a76d8cc
@ -65,7 +65,7 @@ public class UserController {
|
|||||||
userService.changePassword(passwordDto, userId);
|
userService.changePassword(passwordDto, userId);
|
||||||
return ResponseEntity.ok("Password changed successfully");
|
return ResponseEntity.ok("Password changed successfully");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ResponseEntity.badRequest().body(e.getMessage());
|
return ResponseEntity.status(HttpStatus.NOT_ACCEPTABLE).body(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,12 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
User user = userRepository.findById(id).orElseThrow(IllegalArgumentException::new);
|
User user = userRepository.findById(id).orElseThrow(IllegalArgumentException::new);
|
||||||
|
|
||||||
|
|
||||||
|
if (isEmailExist(infoDto.getEmail())) {
|
||||||
|
throw new IllegalArgumentException("이미 사용 중인 이메일입니다.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (infoDto.getName() != null)
|
if (infoDto.getName() != null)
|
||||||
user.setName(infoDto.getName());
|
user.setName(infoDto.getName());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user