-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 회원 엔티티에 회원탈퇴 기능 추가 * feat: 회원탈퇴하지 않은 회원을 조회하는 기능 추가 * feat: 회원 탈퇴 기능 추가 * feat: 회원 탈퇴 api 추가 * feat: 회원 탈퇴 여부 확인 기능 추가 * feat: 회원 탈퇴 여부 확인 기능 추가 * chore: 회원 탈퇴 관련 flyway script 추가 * feat: 인증 & 인가 작업 시 탈퇴된 회원인지 검증하는 로직 추가
- Loading branch information
Showing
16 changed files
with
407 additions
and
65 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...g/src/main/java/com/ddang/ddang/authentication/application/AuthenticationUserService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ddang.ddang.authentication.application; | ||
|
||
import com.ddang.ddang.user.infrastructure.persistence.JpaUserRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class AuthenticationUserService { | ||
|
||
private final JpaUserRepository userRepository; | ||
|
||
public boolean isWithdrawal(final Long userId) { | ||
return userRepository.existsByIdAndDeletedIsTrue(userId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
backend/ddang/src/main/resources/db/migration/V9__alter_user_tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
alter table users add is_deleted bit; | ||
|
||
UPDATE users SET is_deleted = 0 where auctioneer_count is null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...c/test/java/com/ddang/ddang/authentication/application/AuthenticationUserServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.ddang.ddang.authentication.application; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.ddang.ddang.configuration.IsolateDatabase; | ||
import com.ddang.ddang.user.domain.User; | ||
import com.ddang.ddang.user.infrastructure.persistence.JpaUserRepository; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
@IsolateDatabase | ||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
class AuthenticationUserServiceTest { | ||
|
||
@Autowired | ||
JpaUserRepository userRepository; | ||
|
||
@Autowired | ||
AuthenticationUserService authenticationUserService; | ||
|
||
@Test | ||
void 회원탈퇴한_회원의_id를_전달하면_참을_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.name("회원") | ||
.profileImage("profile.png") | ||
.reliability(4.7d) | ||
.oauthId("12345") | ||
.build(); | ||
|
||
user.withdrawal(); | ||
userRepository.save(user); | ||
|
||
// when | ||
final boolean actual = authenticationUserService.isWithdrawal(user.getId()); | ||
|
||
// then | ||
assertThat(actual).isTrue(); | ||
} | ||
|
||
@Test | ||
void 회원탈퇴하지_않거나_회원가입하지_않은_회원의_id를_전달하면_거짓을_반환한다() { | ||
// given | ||
final User user = User.builder() | ||
.name("회원") | ||
.profileImage("profile.png") | ||
.reliability(4.7d) | ||
.oauthId("12345") | ||
.build(); | ||
|
||
userRepository.save(user); | ||
|
||
// when | ||
final boolean actual = authenticationUserService.isWithdrawal(user.getId()); | ||
|
||
// then | ||
assertThat(actual).isFalse(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.