Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import life.mosu.mosuserver.domain.user.repository.UserJpaRepository;
import life.mosu.mosuserver.global.exception.CustomRuntimeException;
import life.mosu.mosuserver.global.exception.ErrorCode;
import life.mosu.mosuserver.global.util.PhoneNumberUtil;
import life.mosu.mosuserver.presentation.profile.dto.EditProfileRequest;
import life.mosu.mosuserver.presentation.profile.dto.ProfileDetailResponse;
import life.mosu.mosuserver.presentation.profile.dto.SignUpProfileRequest;
Expand Down Expand Up @@ -76,7 +77,7 @@ private void checkIfProfileExistsForUser(UserJpaEntity user) {
private void syncUserInfoFromProfile(UserJpaEntity user, SignUpProfileRequest request) {
if (user.isMosuUser()) {
user.updateUserInfo(Gender.fromName(request.gender()), request.userName(),
request.phoneNumber(), request.birth());
PhoneNumberUtil.formatPhoneNumber(request.phoneNumber()), request.birth());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The phone number from SignUpProfileRequest might contain hyphens (e.g., "010-1234-5678"). Storing phone numbers with optional hyphens can lead to data inconsistency. It's best practice to normalize the phone number by removing hyphens before storing it. This ensures a canonical format in the database for UserJpaEntity.

Note: This change will make the phone number format in UserJpaEntity inconsistent with ProfileJpaEntity, as ProfileJpaEntity is created using request.toEntity() which uses the raw phone number. You should consider normalizing the phone number for ProfileJpaEntity as well for data consistency across the system, perhaps by modifying SignUpProfileRequest.toEntity().

Suggested change
PhoneNumberUtil.formatPhoneNumber(request.phoneNumber()), request.birth());
PhoneNumberUtil.formatPhoneNumber(request.phoneNumber().replaceAll("-", "")), request.birth());

}
}
}
Expand Down