refactor: findByEmail 중복코드 제거
This commit is contained in:
@@ -39,13 +39,7 @@ public class UserServiceImpl implements UserService {
|
||||
@Override
|
||||
@Transactional
|
||||
public User delete(@Valid DeleteUserDTO deleteUserDto) {
|
||||
User user = userRepository.findByEmail(deleteUserDto.getEmail())
|
||||
.orElseThrow(() -> {
|
||||
log.error("존재하지 않는 이메일 입니다. :: {}", deleteUserDto.getEmail());
|
||||
throw new EmailNotFoundException();
|
||||
}
|
||||
);
|
||||
|
||||
User user = findByEmail(deleteUserDto.getEmail());
|
||||
return user.delete(deleteUserDto);
|
||||
}
|
||||
|
||||
@@ -59,7 +53,11 @@ public class UserServiceImpl implements UserService {
|
||||
@Override
|
||||
public User findByEmail(String email) {
|
||||
return userRepository.findByEmail(email)
|
||||
.orElseThrow(EmailNotFoundException::new);
|
||||
.orElseThrow(() -> {
|
||||
log.error("존재하지 않는 이메일 입니다. :: {}", email);
|
||||
throw new EmailNotFoundException();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private User findNotDeletedUserByEmail(String email) {
|
||||
|
||||
Reference in New Issue
Block a user