Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 회원 탈퇴 시 차단 데이터 삭제 #401

Merged
merged 1 commit into from
Sep 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ public interface BlacklistQueryUseCase {
Set<Long> getBlackMemberIds(Long memberId);

Boolean checkBlockOrBlocked(Long loginMemberId, Long memberId);

void deleteAllByMemberId(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ public interface BlacklistPersistencePort {
List<Long> findMemberIdsWhoBlockedMe(Long memberId);

Boolean isBlockOrBlocked(Long loginMemberId, Long memberId);

void deleteAllByMemberId(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public Boolean checkBlockOrBlocked(Long loginMemberId, Long memberId) {
return blacklistPersistencePort.isBlockOrBlocked(loginMemberId, memberId);
}

@Override
public void deleteAllByMemberId(Long memberId) {
blacklistPersistencePort.deleteAllByMemberId(memberId);
}

private List<Long> getBlackMemberIdsByMemberId(Long memberId) {
return blacklistPersistencePort.findBlackMemberIdsByMemberId(memberId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ public Boolean isBlockOrBlocked(Long loginMemberId, Long memberId) {
.isEmpty();
}

@Override
public void deleteAllByMemberId(Long memberId) {
queryFactory
.delete(blacklistEntity)
.where(memberEq(memberId).or(blackMemberEq(memberId)))
.execute();
}

private static BooleanExpression memberEq(Long memberId) {
if (memberId == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.depromeet.auth.vo.AccessTokenInfo;
import com.depromeet.auth.vo.JwtToken;
import com.depromeet.auth.vo.kakao.KakaoAccountProfile;
import com.depromeet.blacklist.port.in.usecase.BlacklistQueryUseCase;
import com.depromeet.dto.auth.AccountProfileResponse;
import com.depromeet.exception.NotFoundException;
import com.depromeet.followinglog.port.in.FollowingMemoryLogUseCase;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class AuthFacade {
private final ImageUpdateUseCase imageUpdateUseCase;
private final DeleteMemoryUseCase deleteMemoryUseCase;
private final FavoritePoolUseCase favoritePoolUseCase;
private final BlacklistQueryUseCase blacklistQueryUseCase;
private final DeleteReactionUseCase deleteReactionUseCase;
private final DeleteFollowLogUseCase deleteFollowLogUseCase;
private final DeleteReactionLogUseCase deleteReactionLogUseCase;
Expand Down Expand Up @@ -148,6 +150,8 @@ public void deleteAccount(Long memberId) {
followUseCase.deleteByMemberId(memberId);
// Follow log 삭제
deleteFollowLogUseCase.deleteAllByMemberId(memberId);
// Blacklist 삭제
blacklistQueryUseCase.deleteAllByMemberId(memberId);
// Member 삭제
memberUseCase.deleteById(memberId);
socialUseCase.revokeAccount(accountType);
Expand Down
Loading