-
Notifications
You must be signed in to change notification settings - Fork 2
develop to prod #279
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
develop to prod #279
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 | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| package life.mosu.mosuserver.global.annotation; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.Constraint; | ||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.Payload; | ||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.constraints.NotBlank; | ||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.validation.constraints.Pattern; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.lang.annotation.ElementType; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.lang.annotation.Retention; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.lang.annotation.RetentionPolicy; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.lang.annotation.Target; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Pattern( | ||||||||||||||||||||||||||||||||||||||||||||||
| regexp = "^01[016789]-\\d{3,4}-\\d{4}$", | ||||||||||||||||||||||||||||||||||||||||||||||
| message = "전화번호 형식은 010-XXXX-XXXX 이어야 합니다." | ||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||
| @NotBlank | ||||||||||||||||||||||||||||||||||||||||||||||
| @Target({ElementType.FIELD, ElementType.PARAMETER}) | ||||||||||||||||||||||||||||||||||||||||||||||
| @Retention(RetentionPolicy.RUNTIME) | ||||||||||||||||||||||||||||||||||||||||||||||
| @Constraint(validatedBy = {}) | ||||||||||||||||||||||||||||||||||||||||||||||
| public @interface NotBlankPhoneNumberPattern { | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| String message() default "전화번호 형식은 010-XXXX-XXXX 이어야 합니다."; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+22
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 error message is specific to pattern violations and might be confusing if the validation fails because the phone number is blank. A more comprehensive message that covers both
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| Class<?>[] groups() default {}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| Class<? extends Payload>[] payload() default {}; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,7 @@ public enum ErrorCode { | |||||
| USER_INFO_INVALID(HttpStatus.BAD_REQUEST, "유효하지 않은 사용자 정보입니다."), | ||||||
| USER_NOT_ACCESS_FORBIDDEN(HttpStatus.BAD_REQUEST, "접근 권한이 없는 사용자입니다"), | ||||||
| USER_SAVE_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "사용자 저장에 실패했습니다."), | ||||||
| INVAILD_GENDER(HttpStatus.BAD_REQUEST, "유효하지 않은 성별 값입니다."), | ||||||
|
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. There's a typo in the enum constant name. It should be
Suggested change
|
||||||
| // 신청 관련 에러 | ||||||
| WRONG_SUBJECT_TYPE(HttpStatus.BAD_REQUEST, "잘못된 과목명 입니다."), | ||||||
| WRONG_LUNCH_TYPE(HttpStatus.BAD_REQUEST, "잘못된 도시락명 입니다."), | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,8 +12,8 @@ | |
| import life.mosu.mosuserver.domain.user.entity.UserJpaEntity; | ||
| import life.mosu.mosuserver.domain.user.entity.UserRole; | ||
| import life.mosu.mosuserver.global.annotation.LoginIdPattern; | ||
| import life.mosu.mosuserver.global.annotation.NotBlankPhoneNumberPattern; | ||
| import life.mosu.mosuserver.global.annotation.PasswordPattern; | ||
| import life.mosu.mosuserver.global.annotation.PhoneNumberPattern; | ||
| import org.springframework.security.crypto.password.PasswordEncoder; | ||
|
|
||
| public record SignUpAccountRequest( | ||
|
|
@@ -45,7 +45,7 @@ public record SignUpAccountRequest( | |
|
|
||
| @Schema(description = "휴대폰 번호", example = "010-1234-5678", required = true) | ||
| @NotBlank(message = "휴대폰 번호는 필수입니다.") | ||
|
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. |
||
| @PhoneNumberPattern | ||
| @NotBlankPhoneNumberPattern | ||
| String phoneNumber, | ||
|
|
||
| SignUpServiceTermRequest serviceTermRequest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| import life.mosu.mosuserver.domain.profile.entity.Gender; | ||
| import life.mosu.mosuserver.domain.profile.entity.Grade; | ||
| import life.mosu.mosuserver.domain.profile.entity.ProfileJpaEntity; | ||
| import life.mosu.mosuserver.global.annotation.PhoneNumberPattern; | ||
| import life.mosu.mosuserver.global.annotation.NotBlankPhoneNumberPattern; | ||
|
|
||
| @Schema(description = "프로필 등록 요청 DTO") | ||
| public record SignUpProfileRequest( | ||
|
|
@@ -29,7 +29,7 @@ public record SignUpProfileRequest( | |
|
|
||
| @Schema(description = "휴대폰 번호", example = "010-1234-5678", required = true) | ||
| @NotBlank(message = "휴대폰 번호는 필수입니다.") | ||
|
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. |
||
| @PhoneNumberPattern | ||
| @NotBlankPhoneNumberPattern | ||
| String phoneNumber, | ||
|
|
||
| @Schema(description = "이메일 주소", example = "hong@example.com") | ||
|
|
||
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.
Following the correction of the typo in
ErrorCodefromINVAILD_GENDERtoINVALID_GENDER, this line should be updated to use the correct enum constant.