-
Notifications
You must be signed in to change notification settings - Fork 1
feat: enhance user sign-up process with logging and phone number retr… #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,23 +6,26 @@ | |
| import life.mosu.mosuserver.global.exception.ErrorCode; | ||
| import life.mosu.mosuserver.global.processor.StepProcessor; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @Component | ||
| @RequiredArgsConstructor | ||
| @Slf4j | ||
| public class SignUpAccountStepProcessor implements StepProcessor<UserJpaEntity, UserJpaEntity> { | ||
|
|
||
| private final UserJpaRepository userRepository; | ||
|
|
||
| @Transactional | ||
| @Override | ||
| public UserJpaEntity process(UserJpaEntity user) { | ||
| if (userRepository.existsByPhoneNumber(user.getPhoneNumber())) { | ||
| if (userRepository.existsByPhoneNumber(user.getOriginPhoneNumber())) { | ||
| throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS); | ||
| } else if (userRepository.existsByLoginId(user.getLoginId())) { | ||
| throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS); | ||
| } | ||
|
Comment on lines
+23
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both existence checks for phone number and login ID throw the same generic |
||
| log.info("Processing user sign-up: {}", user); | ||
| return userRepository.save(user); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,4 +125,25 @@ public String getPhoneNumber() { | |
| public String getPhoneNumberWithoutHyphen() { | ||
| return getPhoneNumber().replaceAll("-", ""); | ||
| } | ||
|
|
||
| public String getOriginPhoneNumber() { | ||
| return phoneNumber; | ||
| } | ||
|
Comment on lines
+129
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The addition of |
||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "UserJpaEntity{" + | ||
| "id=" + id + | ||
| ", loginId='" + loginId + '\'' + | ||
| ", password='" + password + '\'' + | ||
| ", gender=" + gender + | ||
| ", name='" + name + '\'' + | ||
| ", birth=" + birth + | ||
| ", phoneNumber='" + phoneNumber + '\'' + | ||
| ", customerKey='" + customerKey + '\'' + | ||
| ", agreedToMarketing=" + agreedToMarketing + | ||
| ", userRole=" + userRole + | ||
| ", provider=" + provider + | ||
| '}'; | ||
| } | ||
|
Comment on lines
+134
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation of @Override
public String toString() {
return "UserJpaEntity{" +
"id=" + id +
", loginId='" + loginId + '\'' +
", password='[PROTECTED]'" +
", gender=" + gender +
", name='" + name + '\'' +
", birth=" + birth +
", phoneNumber='" + phoneNumber + '\'' +
", customerKey='" + customerKey + '\'' +
", agreedToMarketing=" + agreedToMarketing +
", userRole=" + userRole +
", provider=" + provider +
'}';
} |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message
log : {}is not very descriptive. Good log messages should provide context about what is being logged. This helps with debugging and monitoring. Please provide a more meaningful message.