Skip to content

Commit 882b29d

Browse files
authored
[FIX] 탈퇴계정 이메일 여부 판단 로직 추가
[FIX] 탈퇴계정 이메일 여부 판단 로직 추가
2 parents 260ee70 + 383e9ac commit 882b29d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

q-api/src/main/java/com/qcard/api/account/service/AccountService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ public SignUpRes signUp(AccountReq accountReq) {
2323
if (!accountReq.isValid()) {
2424
throw new IllegalArgumentException("사용자에 대한 올바른 정보를 입력해주세요.");
2525
}
26-
else if (accountDomainService.existsAccountByEmail(accountReq.getEmail())) {
27-
throw new IllegalArgumentException("이미 계정이 존재합니다.");
26+
else if(accountDomainService.findAccountByEmail(accountReq.getEmail()) != null){
27+
throw new IllegalArgumentException((accountReq.getEmail() + ": 이미 존재하는 계정입니다."));
2828
}
2929

30-
Account account = accountDomainService.createAccount(
30+
Account newAccount = accountDomainService.createAccount(
3131
accountReq.getEmail(),
3232
accountReq.getName(),
3333
jwtService.encryptPassword(accountReq.getPassword()));
34-
return new SignUpRes(account.getName());
34+
return new SignUpRes(newAccount.getName());
3535
}
3636

3737
public TokenRes signIn(SignInReq signInReq) {

q-domain/src/main/java/com/qcard/domains/account/service/AccountDomainService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ public Optional<Account> findOpAccountByEmail(String email) {
3030

3131
@Transactional(readOnly = true)
3232
public Account findAccountByEmail(String email) {
33-
return accountRepository.findByEmail(email)
33+
Account account = accountRepository.findByEmail(email)
3434
.orElseThrow(() -> new IllegalArgumentException(email + ": 존재하지 않는 계정입니다"));
35+
if(account.getIsDeleted()) {
36+
throw new IllegalArgumentException(email + ": 탈퇴한 계정 이메일입니다.");
37+
}
38+
39+
return account;
3540
}
3641

42+
3743
@Transactional(readOnly = true)
3844
public Account findAccountById(Long id) {
3945
return accountRepository.findById(id)

q-domain/src/main/java/com/qcard/domains/question/repository/AnswerRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.util.Optional;
1010

1111
public interface AnswerRepository extends JpaRepository<Answer, Long>, AnswerRepositoryCustom {
12-
List<Answer> findAllByQuestionIdOrderByTypeDesc(Long questionId);
1312

1413
List<Answer> findAllByAccount(Account account);
1514

0 commit comments

Comments
 (0)