Skip to content

Commit

Permalink
fix: 유저 탈퇴 오류 수정 - deleteUserCompletedCredits 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
5uhwann committed Jun 30, 2024
1 parent 5b864db commit d635edb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.transaction.annotation.Transactional;

import com.plzgraduate.myongjigraduatebe.completedcredit.application.port.DeleteCompletedCreditPort;
import com.plzgraduate.myongjigraduatebe.core.meta.UseCase;
import com.plzgraduate.myongjigraduatebe.parsing.application.port.DeleteParsingTextHistoryPort;
import com.plzgraduate.myongjigraduatebe.takenlecture.application.usecase.delete.DeleteTakenLectureUseCase;
Expand All @@ -22,6 +23,7 @@ class WithDrawUserService implements WithDrawUserUseCase {
private final DeleteTakenLectureUseCase deleteTakenLectureByUserUseCase;
private final DeleteParsingTextHistoryPort deleteParsingTextHistoryPort;
private final DeleteUserPort deleteUserPort;
private final DeleteCompletedCreditPort deleteCompletedCreditPort;
private final PasswordEncoder passwordEncoder;

@Override
Expand All @@ -30,6 +32,7 @@ public void withDraw(Long userId, String password) {
user.matchPassword(passwordEncoder, password);
deleteTakenLectureByUserUseCase.deleteAllTakenLecturesByUser(user);
deleteParsingTextHistoryPort.deleteUserParsingTextHistory(user);
deleteCompletedCreditPort.deleteAllCompletedCredits(user);
deleteUserPort.deleteUser(user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import com.plzgraduate.myongjigraduatebe.completedcredit.application.port.DeleteCompletedCreditPort;
import com.plzgraduate.myongjigraduatebe.parsing.application.port.DeleteParsingTextHistoryPort;
import com.plzgraduate.myongjigraduatebe.takenlecture.application.usecase.delete.DeleteTakenLectureUseCase;
import com.plzgraduate.myongjigraduatebe.user.application.port.DeleteUserPort;
Expand All @@ -32,6 +33,8 @@ class WithDrawUserServiceTest {
@Mock
private DeleteUserPort deleteUserPort;
@Mock
private DeleteCompletedCreditPort deleteCompletedCreditPort;
@Mock
private PasswordEncoder passwordEncoder;

@InjectMocks
Expand All @@ -53,6 +56,7 @@ void withDraw() {
withDrawUserService.withDraw(user.getId(), password);
then(deleteTakenLectureByUserUseCase).should().deleteAllTakenLecturesByUser(user);
then(deleteParsingTextHistoryPort).should().deleteUserParsingTextHistory(user);
then(deleteCompletedCreditPort).should().deleteAllCompletedCredits(user);
then(deleteUserPort).should().deleteUser(user);
}

Expand Down

0 comments on commit d635edb

Please sign in to comment.