Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/com/feesh/domain/auth/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
import com.feesh.global.exception.CustomException;
import com.feesh.global.exception.ErrorCode;
import com.feesh.global.security.JwtTokenProvider;
import com.feesh.domain.post.repository.PostViewRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.Locale;

@Service
Expand All @@ -34,6 +36,7 @@ public class AuthService {
private final PostLikeRepository postLikeRepository;
private final NotificationRepository notificationRepository;
private final PostRepository postRepository;
private final PostViewRepository postViewRepository;

@Transactional
public SignupResponse signup(SignupRequest request) {
Expand Down Expand Up @@ -125,6 +128,8 @@ public void withdraw(Long userId) {
notificationRepository.deleteAllByReceiverId(userId);
notificationRepository.deleteAllBySenderId(userId);

postViewRepository.deleteAllByPost_Author_Id(userId);

postRepository.deleteAllByAuthor_Id(userId);

userRepository.delete(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ public interface PostViewRepository extends JpaRepository<PostView, Long> {
boolean existsByPost_IdAndUser_Id(Long postId, Long userId);

void deleteAllByPost_Id(Long postId);

void deleteAllByPost_Author_Id(Long userId);
}
Loading