Skip to content

Commit

Permalink
refactor: 온보딩 bevy 관련 로직 및 테스트 제거 (#820)
Browse files Browse the repository at this point in the history
* refactor: bevy 관련 로직 제거

* test: bevy 관련 테스트 제거

* chore: spotless 적용
  • Loading branch information
kckc0608 authored Nov 12, 2024
1 parent 482acaf commit 0e1612f
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ public ResponseEntity<MemberUnivStatusResponse> checkUnivVerification() {
return ResponseEntity.ok().body(response);
}

@Operation(summary = "GDSC Bevy 연동하기", description = "GDSC Bevy 가입 상태를 업데이트합니다.")
@PostMapping("/me/link-bevy")
public ResponseEntity<Void> linkBevy() {
onboardingMemberService.verifyBevyStatus();
return ResponseEntity.ok().build();
}

@Operation(summary = "기본 회원정보 작성", description = "기본 회원정보를 작성합니다.")
@PostMapping("/me/basic-info")
public ResponseEntity<Void> updateBasicMemberInfo(@Valid @RequestBody BasicMemberInfoRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ public MemberUnivStatusResponse checkUnivVerificationStatus() {
return MemberUnivStatusResponse.from(currentMember);
}

@Transactional
public void verifyBevyStatus() {
Member currentMember = memberUtil.getCurrentMember();
currentMember.verifyBevy();
memberRepository.save(currentMember);
}

@Transactional
public void updateBasicMemberInfo(BasicMemberInfoRequest request) {
Member currentMember = memberUtil.getCurrentMember();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,21 @@ public class AssociateRequirement {
@Enumerated(EnumType.STRING)
private RequirementStatus discordStatus;

@Enumerated(EnumType.STRING)
private RequirementStatus bevyStatus;

@Enumerated(EnumType.STRING)
private RequirementStatus infoStatus;

@Builder(access = AccessLevel.PRIVATE)
private AssociateRequirement(
RequirementStatus univStatus,
RequirementStatus discordStatus,
RequirementStatus bevyStatus,
RequirementStatus infoStatus) {
RequirementStatus univStatus, RequirementStatus discordStatus, RequirementStatus infoStatus) {
this.univStatus = univStatus;
this.discordStatus = discordStatus;
this.bevyStatus = bevyStatus;
this.infoStatus = infoStatus;
}

public static AssociateRequirement unsatisfied() {
return AssociateRequirement.builder()
.univStatus(UNSATISFIED)
.discordStatus(UNSATISFIED)
.bevyStatus(UNSATISFIED)
.infoStatus(UNSATISFIED)
.build();
}
Expand All @@ -63,10 +55,6 @@ public void verifyDiscord() {
discordStatus = SATISFIED;
}

public void verifyBevy() {
bevyStatus = SATISFIED;
}

public void verifyInfo() {
infoStatus = SATISFIED;
}
Expand All @@ -81,10 +69,6 @@ private boolean isDiscordSatisfied() {
return discordStatus == SATISFIED;
}

private boolean isBevySatisfied() {
return bevyStatus == SATISFIED;
}

private boolean isInfoSatisfied() {
return infoStatus == SATISFIED;
}
Expand All @@ -100,10 +84,6 @@ public void validateAllSatisfied() {
throw new CustomException(DISCORD_NOT_SATISFIED);
}

if (!isBevySatisfied()) {
throw new CustomException(BEVY_NOT_SATISFIED);
}

if (!isInfoSatisfied()) {
throw new CustomException(BASIC_INFO_NOT_SATISFIED);
}
Expand All @@ -119,7 +99,6 @@ public void checkVerifiableUniv() {
* 모든 준회원 조건을 강등합니다.
*/
public void demoteAssociateRequirement() {
bevyStatus = UNSATISFIED;
discordStatus = UNSATISFIED;
infoStatus = UNSATISFIED;
univStatus = UNSATISFIED;
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,12 @@ public void verifyDiscord(String discordUsername, String nickname) {
registerEvent(new MemberAssociateEvent(this.id));
}

/**
* Bevy 서버와의 연동을 진행합니다.
* Bevy 인증상태를 인증 처리합니다.
*/
public void verifyBevy() {
validateStatusUpdatable();

associateRequirement.verifyBevy();

registerEvent(new MemberAssociateEvent(id));
}

/**
* 게스트에서 준회원으로 승급합니다.
* 본 로직은 승급조건 충족 이벤트로 트리거됩니다. 다음 조건을 모두 충족하면 승급됩니다.
* 조건 1 : 기본 회원정보 작성
* 조건 2 : 재학생 인증
* 조건 3 : 디스코드 인증
* 조건 4 : Bevy 인증
*/
public void advanceToAssociate() {
validateStatusUpdatable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ public record MemberAssociateRequirementDto(
UnivVerificationStatus univStatus,
@Schema(description = "디스코드 인증상태", implementation = RequirementStatus.class)
RequirementStatus discordStatus,
@Schema(description = "bevy 인증상태", implementation = RequirementStatus.class) RequirementStatus bevyStatus,
@Schema(description = "회원정보 입력상태", implementation = RequirementStatus.class) RequirementStatus infoStatus) {
public static MemberAssociateRequirementDto of(Member member, UnivVerificationStatus univVerificationStatus) {
return new MemberAssociateRequirementDto(
univVerificationStatus,
member.getAssociateRequirement().getDiscordStatus(),
member.getAssociateRequirement().getBevyStatus(),
member.getAssociateRequirement().getInfoStatus());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ public static DepartmentDto from(Department department) {
}
}

record RequirementDto(String univStatus, String discordStatus, String bevyStatus) {
record RequirementDto(String univStatus, String discordStatus) {
public static RequirementDto from(AssociateRequirement associateRequirement) {
return new RequirementDto(
associateRequirement.getUnivStatus().name(),
associateRequirement.getDiscordStatus().name(),
associateRequirement.getBevyStatus().name());
associateRequirement.getDiscordStatus().name());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public enum ErrorCode {
// Requirement
UNIV_NOT_SATISFIED(HttpStatus.CONFLICT, "재학생 인증이 완료되지 않았습니다."),
DISCORD_NOT_SATISFIED(HttpStatus.CONFLICT, "디스코드 인증이 완료되지 않았습니다."),
BEVY_NOT_SATISFIED(HttpStatus.CONFLICT, "GDSC Bevy 가입이 완료되지 않았습니다."),
EMAIL_ALREADY_SATISFIED(HttpStatus.CONFLICT, "이미 이메일 인증된 회원입니다."),
BASIC_INFO_NOT_SATISFIED(HttpStatus.CONFLICT, "기본 회원정보 작성이 완료되지 않았습니다."),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class 역할로_조회할때 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, UNIV_EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

flushAndClearBeforeExecute();
Expand All @@ -110,7 +109,6 @@ class 역할로_조회할때 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, UNIV_EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

flushAndClearBeforeExecute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class 게스트_회원가입시 {
// then
assertThat(requirement.getUnivStatus()).isEqualTo(UNSATISFIED);
assertThat(requirement.getDiscordStatus()).isEqualTo(UNSATISFIED);
assertThat(requirement.getBevyStatus()).isEqualTo(UNSATISFIED);
assertThat(requirement.getInfoStatus()).isEqualTo(UNSATISFIED);
}
}
Expand Down Expand Up @@ -98,19 +97,6 @@ class 준회원_가입조건_인증시도시 {
AssociateRequirement requirement = member.getAssociateRequirement();
assertThat(requirement.getDiscordStatus()).isEqualTo(SATISFIED);
}

@Test
void Bevy_인증시_준회원_가입조건중_Bevy_인증상태가_인증된다() {
// given
Member member = Member.createGuest(OAUTH_ID);

// when
member.verifyBevy();

// then
AssociateRequirement requirement = member.getAssociateRequirement();
assertThat(requirement.getBevyStatus()).isEqualTo(SATISFIED);
}
}

@Nested
Expand All @@ -123,7 +109,6 @@ class 준회원으로_승급시도시 {

member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyBevy();

// when & then
assertThatThrownBy(member::advanceToAssociate)
Expand All @@ -138,29 +123,13 @@ class 준회원으로_승급시도시 {

member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyBevy();

// when & then
assertThatThrownBy(member::advanceToAssociate)
.isInstanceOf(CustomException.class)
.hasMessage(DISCORD_NOT_SATISFIED.getMessage());
}

@Test
void Bevy_연동하지_않았으면_실패한다() {
// given
Member member = Member.createGuest(OAUTH_ID);

member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);

// when & then
assertThatThrownBy(member::advanceToAssociate)
.isInstanceOf(CustomException.class)
.hasMessage(BEVY_NOT_SATISFIED.getMessage());
}

@Test
void 이미_준회원으로_승급_돼있으면_실패한다() {
// given
Expand All @@ -169,7 +138,6 @@ class 준회원으로_승급시도시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

// when & then
Expand All @@ -186,7 +154,6 @@ class 준회원으로_승급시도시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();

// when
member.advanceToAssociate();
Expand Down Expand Up @@ -271,19 +238,6 @@ class 회원수정시 {
.hasMessage(MEMBER_DELETED.getMessage());
}

@Test
void Bevy인증시_탈퇴한_유저면_실패한다() {
// given
Member member = Member.createGuest(OAUTH_ID);

member.withdraw();

// when & then
assertThatThrownBy(member::verifyBevy)
.isInstanceOf(CustomException.class)
.hasMessage(MEMBER_DELETED.getMessage());
}

@Nested
class 정회원으로_승급_시도시 {
@Test
Expand All @@ -294,7 +248,6 @@ class 정회원으로_승급_시도시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();
member.advanceToRegular();

Expand Down Expand Up @@ -323,7 +276,6 @@ class 정회원으로_승급_시도시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

// when
Expand All @@ -345,7 +297,6 @@ class 비회원으로_강등시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

// when
Expand All @@ -368,9 +319,8 @@ class 비회원으로_강등시 {
.extracting(
AssociateRequirement::getDiscordStatus,
AssociateRequirement::getInfoStatus,
AssociateRequirement::getBevyStatus,
AssociateRequirement::getUnivStatus)
.containsExactly(UNSATISFIED, UNSATISFIED, UNSATISFIED, UNSATISFIED);
.containsExactly(UNSATISFIED, UNSATISFIED, UNSATISFIED);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class 멤버십_가입신청시 {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();

Recruitment recruitment = Recruitment.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private Member createAssociateMember(Long id) {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();
ReflectionTestUtils.setField(member, "id", id);
return member;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ private Member createAssociateMember(Long id) {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();
ReflectionTestUtils.setField(member, "id", id);
return member;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public Member createAssociateMember(Long id) {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();
return member;
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ protected Member createMember() {
member.completeUnivEmailVerification(UNIV_EMAIL);
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.updateDiscordId(DISCORD_ID);

return memberRepository.save(member);
Expand All @@ -168,7 +167,6 @@ protected Member createAssociateMember() {
member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL);
member.completeUnivEmailVerification(UNIV_EMAIL);
member.verifyDiscord(DISCORD_USERNAME, NICKNAME);
member.verifyBevy();
member.advanceToAssociate();
return memberRepository.save(member);
}
Expand Down

0 comments on commit 0e1612f

Please sign in to comment.