-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/505 #506
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
Merged
Merged
Feature/505 #506
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| # Feature #505: 전화번호 입력 시점 변경 | ||
|
|
||
| ## 개요 | ||
|
|
||
| 회원가입 시 전화번호를 필수에서 선택으로 변경하고, 대여 시점에 전화번호를 수집하도록 변경한다. | ||
|
|
||
| ## 배경 | ||
|
|
||
| - 현재: 회원가입 시 전화번호 필수 입력 | ||
| - 변경: 회원가입 시 전화번호 선택, 대여 시 전화번호 필수 입력 | ||
|
|
||
| ## 변경 사항 | ||
|
|
||
| ### 1. 회원가입 (JoinRequest) | ||
|
|
||
| **파일:** `src/main/kotlin/upbrella/be/user/dto/request/JoinRequest.kt` | ||
|
|
||
| | 항목 | 현재 | 변경 후 | | ||
| |------|------|---------| | ||
| | phoneNumber | `@NotBlank` (필수) | nullable (선택) | | ||
| | 검증 | 필수 + 패턴 검증 | 입력 시에만 패턴 검증 | | ||
|
|
||
| ```kotlin | ||
| // 변경 전 | ||
| @field:NotBlank | ||
| @field:Size(max = 16) | ||
| @field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "유효한 전화번호 형식이 아닙니다.") | ||
| val phoneNumber: String = "" | ||
|
|
||
| // 변경 후 | ||
| @field:Size(max = 16) | ||
| @field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "유효한 전화번호 형식이 아닙니다.") | ||
| val phoneNumber: String? = null | ||
| ``` | ||
|
|
||
| ### 2. User 엔티티 | ||
|
|
||
| **파일:** `src/main/kotlin/upbrella/be/user/entity/User.kt` | ||
|
|
||
| | 항목 | 현재 | 변경 후 | | ||
| |------|------|---------| | ||
| | phoneNumber | `String` (non-null) | `String?` (nullable) | | ||
|
|
||
| ```kotlin | ||
| // 변경 전 | ||
| var phoneNumber: String, | ||
|
|
||
| // 변경 후 | ||
| var phoneNumber: String? = null, | ||
| ``` | ||
|
|
||
| **추가 메서드:** | ||
| ```kotlin | ||
| fun updatePhoneNumber(phoneNumber: String) { | ||
| this.phoneNumber = phoneNumber | ||
| } | ||
|
|
||
| fun hasPhoneNumber(): Boolean { | ||
| return !phoneNumber.isNullOrBlank() | ||
| } | ||
| ``` | ||
|
|
||
| ### 3. 대여 요청 (RentUmbrellaByUserRequest) | ||
|
|
||
| **파일:** `src/main/kotlin/upbrella/be/rent/dto/request/RentUmbrellaByUserRequest.kt` | ||
|
|
||
| | 항목 | 현재 | 변경 후 | | ||
| |------|------|---------| | ||
| | phoneNumber | 없음 | 추가 (필수) | | ||
|
|
||
| ```kotlin | ||
| // 변경 후 | ||
| data class RentUmbrellaByUserRequest( | ||
| val region: String? = null, | ||
| val storeId: Long = 0, | ||
| val umbrellaId: Long = 0, | ||
| @field:Size(max = 400, message = "conditionReport는 최대 400자여야 합니다.") | ||
| val conditionReport: String? = null, | ||
| // 추가 | ||
| @field:NotBlank(message = "전화번호는 필수입니다.") | ||
| @field:Size(max = 16) | ||
| @field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "유효한 전화번호 형식이 아닙니다.") | ||
| val phoneNumber: String = "" | ||
| ) | ||
| ``` | ||
|
|
||
| ### 4. 대여 서비스 (RentService) | ||
|
|
||
| **파일:** `src/main/kotlin/upbrella/be/rent/service/RentService.kt` | ||
|
|
||
| `addRental` 메서드에 전화번호 업데이트 로직 추가: | ||
|
|
||
| ```kotlin | ||
| @Transactional | ||
| fun addRental(rentUmbrellaByUserRequest: RentUmbrellaByUserRequest, userToRent: User) { | ||
| // 기존 검증 로직... | ||
|
|
||
| // 전화번호 업데이트 (신규 추가) | ||
| if (!userToRent.hasPhoneNumber()) { | ||
| userToRent.updatePhoneNumber(rentUmbrellaByUserRequest.phoneNumber) | ||
| } | ||
|
|
||
| // 기존 대여 로직... | ||
| } | ||
| ``` | ||
|
|
||
| ### 5. 대여 폼 응답 (RentFormResponse) | ||
|
|
||
| **파일:** `src/main/kotlin/upbrella/be/rent/dto/response/RentFormResponse.kt` | ||
|
|
||
| 대여 폼 조회 시 사용자의 전화번호 유무를 반환하여 프론트엔드에서 입력 필드 표시 여부 결정: | ||
|
|
||
| ```kotlin | ||
| data class RentFormResponse( | ||
| // 기존 필드들... | ||
| val hasPhoneNumber: Boolean // 추가 | ||
| ) | ||
| ``` | ||
|
|
||
| ## API 변경 사항 | ||
|
|
||
| ### POST /users/join (회원가입) | ||
|
|
||
| **Request Body 변경:** | ||
| ```json | ||
| { | ||
| "name": "홍길동", | ||
| "email": "test@example.com", | ||
| "phoneNumber": "010-1234-5678", // 선택 (nullable) | ||
| "bank": "신한", | ||
| "accountNumber": "110-123-456789" | ||
| } | ||
| ``` | ||
|
|
||
| ### GET /rent/form/{umbrellaId} (대여 폼 조회) | ||
|
|
||
| **Response Body 변경:** | ||
| ```json | ||
| { | ||
| "code": 200, | ||
| "message": "success", | ||
| "data": { | ||
| "umbrellaUuid": 1, | ||
| "storeMetaId": 1, | ||
| "classification": "대여소", | ||
| "rentStoreName": "스타벅스 강남점", | ||
| "hasPhoneNumber": false // 추가 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### POST /rent (우산 대여) | ||
|
|
||
| **Request Body 변경:** | ||
| ```json | ||
| { | ||
| "region": "강남", | ||
| "storeId": 1, | ||
| "umbrellaId": 1, | ||
| "conditionReport": "상태 양호", | ||
| "phoneNumber": "010-1234-5678" // 추가 (필수) | ||
| } | ||
| ``` | ||
|
|
||
| ## 영향 받는 파일 | ||
|
|
||
| | 파일 | 변경 내용 | | ||
| |------|----------| | ||
| | `JoinRequest.kt` | phoneNumber nullable로 변경 | | ||
| | `User.kt` | phoneNumber nullable + 메서드 추가 | | ||
| | `RentUmbrellaByUserRequest.kt` | phoneNumber 필드 추가 | | ||
| | `RentService.kt` | 전화번호 업데이트 로직 추가 | | ||
| | `RentFormResponse.kt` | hasPhoneNumber 필드 추가 | | ||
| | `UserInfoResponse.kt` | phoneNumber nullable 처리 | | ||
| | `SingleUserInfoResponse.kt` | phoneNumber nullable 처리 | | ||
| | `RentalHistoryResponse.kt` | phoneNumber nullable 처리 | | ||
| | `HistoryInfoDto.kt` | phoneNumber nullable 처리 | | ||
|
|
||
| ## 테스트 케이스 | ||
|
|
||
| ### 회원가입 | ||
| - [ ] 전화번호 없이 회원가입 성공 | ||
| - [ ] 전화번호 포함하여 회원가입 성공 | ||
| - [ ] 잘못된 전화번호 형식으로 회원가입 시 실패 | ||
|
|
||
| ### 대여 | ||
| - [ ] 전화번호 없는 사용자가 대여 시 전화번호 저장됨 | ||
| - [ ] 전화번호 있는 사용자가 대여 시 기존 전화번호 유지 | ||
| - [ ] 대여 시 잘못된 전화번호 형식이면 실패 | ||
|
|
||
| ### 대여 폼 | ||
| - [ ] 전화번호 없는 사용자: `hasPhoneNumber: false` | ||
| - [ ] 전화번호 있는 사용자: `hasPhoneNumber: true` | ||
|
|
||
| ## 마이그레이션 | ||
|
|
||
| 기존 사용자 데이터는 변경 없이 유지됩니다. 신규 가입자부터 적용됩니다. | ||
|
|
||
| ## 주의사항 | ||
|
|
||
| 1. **하위 호환성**: 기존 API를 사용하는 클라이언트는 대여 요청 시 phoneNumber 필드를 추가해야 합니다. | ||
| 2. **프론트엔드 연동**: 대여 폼에서 `hasPhoneNumber` 값에 따라 전화번호 입력 필드 표시 여부를 결정해야 합니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove the default value or reconsider the validation.
The default value of
""(empty string) conflicts with the@NotBlankvalidation, which requires a non-empty string. If a caller relies on the default, validation will always fail. Consider removing the default value entirely, as phoneNumber is required during rental per the PR objectives.🔧 Proposed fix
@field:NotBlank(message = "전화번호는 필수입니다.") @field:Size(max = 16) @field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "유효한 전화번호 형식이 아닙니다.") - val phoneNumber: String = "" + val phoneNumber: String📝 Committable suggestion
🤖 Prompt for AI Agents