diff --git a/api/src/main/java/com/tago/api/infra/sms/application/SmsService.java b/api/src/main/java/com/tago/api/infra/sms/application/SmsService.java index ed2c4995..5124c991 100644 --- a/api/src/main/java/com/tago/api/infra/sms/application/SmsService.java +++ b/api/src/main/java/com/tago/api/infra/sms/application/SmsService.java @@ -4,6 +4,7 @@ import com.tago.api.infra.sms.domain.dto.SmsRequest; import com.tago.api.infra.sms.domain.dto.SmsResponse; import com.tago.api.infra.sms.util.VerificationCodeUtil; +import com.tago.domain.member.handler.MemberQueryService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -13,6 +14,7 @@ public class SmsService { private final SmsClient smsClient; private final VerificationCodeUtil verificationCodeUtil; + private final MemberQueryService memberQueryService; public void send(SmsRequest.Send request) { smsClient.send(request); @@ -20,7 +22,13 @@ public void send(SmsRequest.Send request) { public SmsResponse.VerifyCode verifyCode(SmsRequest.VerifyCode request) { verificationCodeUtil.verify(request.getNumber(), request.getCode()); - return new SmsResponse.VerifyCode(true); + return new SmsResponse.VerifyCode(true, isSignUp(request.getNumber())); + } + + public Boolean isSignUp(String number) { + String regEx = "(\\d{3})(\\d{3,4})(\\d{4})"; + String phoneNumber = number.replaceAll(regEx, "$1-$2-$3"); + return memberQueryService.existsByPhoneNumber(phoneNumber); } } diff --git a/api/src/main/java/com/tago/api/infra/sms/domain/dto/SmsResponse.java b/api/src/main/java/com/tago/api/infra/sms/domain/dto/SmsResponse.java index 76f869fe..fb08b817 100644 --- a/api/src/main/java/com/tago/api/infra/sms/domain/dto/SmsResponse.java +++ b/api/src/main/java/com/tago/api/infra/sms/domain/dto/SmsResponse.java @@ -11,6 +11,7 @@ public class SmsResponse { @AllArgsConstructor @Schema(name = "AuthSmsVerifyCodeResponse") public static class VerifyCode { - private boolean isVerify; + private Boolean isVerify; + private Boolean isSignUp; } } \ No newline at end of file