Skip to content
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
5 changes: 2 additions & 3 deletions src/main/java/com/devpick/domain/user/dto/SignupRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

Expand All @@ -22,10 +21,10 @@ public record SignupRequest(
@Size(min = 2, max = 20, message = "닉네임은 2자 이상 20자 이하입니다.")
String nickname,

@NotNull(message = "이용약관 동의 여부는 필수입니다.")
// @NotNull(message = "이용약관 동의 여부는 필수입니다.") // 프론트 미사용 — 재활성화 시 주석 해제
Boolean termsAgreed,

@NotNull(message = "개인정보처리방침 동의 여부는 필수입니다.")
// @NotNull(message = "개인정보처리방침 동의 여부는 필수입니다.") // 프론트 미사용 — 재활성화 시 주석 해제
Boolean privacyAgreed
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
*/
@Transactional
public SignupResponse signup(SignupRequest request) {
if (!Boolean.TRUE.equals(request.termsAgreed()) || !Boolean.TRUE.equals(request.privacyAgreed())) {
throw new DevpickException(ErrorCode.AUTH_CONSENT_REQUIRED);
}
// 프론트 미사용 — 재활성화 시 주석 해제
// if (!Boolean.TRUE.equals(request.termsAgreed()) || !Boolean.TRUE.equals(request.privacyAgreed())) {

Check warning on line 48 in src/main/java/com/devpick/domain/user/service/AuthService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=Devpick-Org_devpick-backend&issues=AZ1_YvjVXISY38E6ZKvX&open=AZ1_YvjVXISY38E6ZKvX&pullRequest=118
// throw new DevpickException(ErrorCode.AUTH_CONSENT_REQUIRED);
// }

if (!emailVerificationRedisService.isVerified(request.email())) {
throw new DevpickException(ErrorCode.AUTH_EMAIL_NOT_VERIFIED_FOR_SIGNUP);
Expand Down
35 changes: 8 additions & 27 deletions src/test/java/com/devpick/domain/user/service/AuthServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,14 @@

// ── signup ──────────────────────────────────────────────────────────

@Test
@DisplayName("이용약관 미동의 — termsAgreed=false이면 AUTH_CONSENT_REQUIRED 예외가 발생한다")
void signup_termsNotAgreed_throwsException() {
// given
SignupRequest request = new SignupRequest("test@devpick.kr", "password123!", "하영", false, true);

// when & then
assertThatThrownBy(() -> authService.signup(request))
.isInstanceOf(DevpickException.class)
.satisfies(e -> assertThat(((DevpickException) e).getErrorCode())
.isEqualTo(ErrorCode.AUTH_CONSENT_REQUIRED));
verify(userRepository, never()).save(any(User.class));
}

@Test
@DisplayName("개인정보처리방침 미동의 — privacyAgreed=false이면 AUTH_CONSENT_REQUIRED 예외가 발생한다")
void signup_privacyNotAgreed_throwsException() {
// given
SignupRequest request = new SignupRequest("test@devpick.kr", "password123!", "하영", true, false);

// when & then
assertThatThrownBy(() -> authService.signup(request))
.isInstanceOf(DevpickException.class)
.satisfies(e -> assertThat(((DevpickException) e).getErrorCode())
.isEqualTo(ErrorCode.AUTH_CONSENT_REQUIRED));
verify(userRepository, never()).save(any(User.class));
}
// 프론트 미사용 — 재활성화 시 주석 해제
// @Test
// @DisplayName("이용약관 미동의 — termsAgreed=false이면 AUTH_CONSENT_REQUIRED 예외가 발생한다")
// void signup_termsNotAgreed_throwsException() { ... }

Check warning on line 60 in src/test/java/com/devpick/domain/user/service/AuthServiceTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=Devpick-Org_devpick-backend&issues=AZ1_YvlQXISY38E6ZKvY&open=AZ1_YvlQXISY38E6ZKvY&pullRequest=118

// @Test
// @DisplayName("개인정보처리방침 미동의 — privacyAgreed=false이면 AUTH_CONSENT_REQUIRED 예외가 발생한다")
// void signup_privacyNotAgreed_throwsException() { ... }

Check warning on line 64 in src/test/java/com/devpick/domain/user/service/AuthServiceTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=Devpick-Org_devpick-backend&issues=AZ1_YvlQXISY38E6ZKvZ&open=AZ1_YvlQXISY38E6ZKvZ&pullRequest=118

@Test
@DisplayName("정상 회원가입 — 이메일 인증 완료 후 회원가입 시 User가 저장되고 is_email_verified=true로 생성된다")
Expand Down
Loading