Skip to content

Commit

Permalink
fix: delete profile-image when user resigned
Browse files Browse the repository at this point in the history
  • Loading branch information
aiaiaiai1 committed Jul 25, 2024
1 parent 1c8ab17 commit be41206
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/gymmi/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class AuthService {
private final TokenProcessor tokenProcessor;
private final UserRepository userRepository;
private final LoginedRepository loginedRepository;
private final ProfileImageRepository profileImageRepository;
private final ImageFileUploader imageFileUploader;

@Transactional
public void registerUser(RegistrationRequest request) {
Expand Down Expand Up @@ -98,6 +100,8 @@ public void resign(User loginedUser, ResignRequest request) {
throw new NotMatchedException("비밀번호가 일치하지 않습니다.");
}
loginedUser.resign();
// 프로필사진 지우기
ProfileImage profileImage = profileImageRepository.getByUserId(loginedUser.getId());
profileImageRepository.delete(profileImage);
imageFileUploader.delete(profileImage.getStoredName());
}
}

0 comments on commit be41206

Please sign in to comment.