Skip to content

Conversation

@birdieHyun
Copy link
Member

@birdieHyun birdieHyun commented Jan 10, 2026

๐ŸŸขย ๊ตฌํ˜„๋‚ด์šฉ

  • user phone number optional๋กœ ๋ณ€๊ฒฝ
  • db์—๋Š” ์ด๋ฏธ nullableํ•˜๊ฒŒ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
image

๐Ÿงฉย ๊ณ ๋ฏผ๊ณผ ํ•ด๊ฒฐ๊ณผ์ •

Summary by CodeRabbit

Release Notes

  • New Features
    • Phone number collection moved to rental time. Create an account without providing a phone number and supply it later when renting an umbrella.
    • Rental forms now display whether you have a phone number on file, helping streamline the rental experience.

โœ๏ธ Tip: You can customize this high-level summary in your review settings.

@birdieHyun birdieHyun self-assigned this Jan 10, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

๐Ÿ“ Walkthrough

Walkthrough

This PR relocates phone number collection from the user signup flow to the rental process. The phoneNumber field becomes optional during registration, required during umbrella rental, and the system automatically captures it if the user lacks one. Related entity, DTO, service, and test changes support this new workflow.

Changes

Cohort / File(s) Summary
Feature Documentation
docs/feature/505.md
Documents feature to defer phone number collection from signup to rental; includes API examples, migration notes, and test outlines
User Entity & Signup Request
src/main/kotlin/upbrella/be/user/entity/User.kt, src/main/kotlin/upbrella/be/user/dto/request/JoinRequest.kt
Makes phoneNumber nullable in User entity; adds updatePhoneNumber(phoneNumber: String) and hasPhoneNumber(): Boolean helpers; removes @NotBlank validation from signup request
User Response DTOs
src/main/kotlin/upbrella/be/user/dto/response/UserInfoResponse.kt, src/main/kotlin/upbrella/be/user/dto/response/SingleUserInfoResponse.kt
Updates phoneNumber field to nullable across all user response objects
Rent Request DTO
src/main/kotlin/upbrella/be/rent/dto/request/RentUmbrellaByUserRequest.kt
Adds phoneNumber field with @NotBlank, @Size(max=16), and @Pattern validations
Rent Response DTOs
src/main/kotlin/upbrella/be/rent/dto/response/RentFormResponse.kt, src/main/kotlin/upbrella/be/rent/dto/response/RentalHistoryResponse.kt, src/main/kotlin/upbrella/be/rent/dto/response/HistoryInfoDto.kt
Adds hasPhoneNumber flag to form response; makes phoneNumber nullable in all rental response objects
Rent Service & Controller
src/main/kotlin/upbrella/be/rent/service/RentService.kt, src/main/kotlin/upbrella/be/rent/controller/RentController.kt
Updates findRentForm to accept User parameter and populate hasPhoneNumber; adds logic to RentService.addRental to initialize missing phone numbers from rental request; adds HttpSession parameter to controller endpoint
Entity Unit Tests
src/test/kotlin/upbrella/be/user/entity/UserTest.kt
Adds 4 tests covering updatePhoneNumber(), hasPhoneNumber() with null/non-null/empty string cases
Service Tests
src/test/kotlin/upbrella/be/rent/service/RentServiceTest.kt
Updates RentUmbrellaByUserRequest construction with phoneNumber; adds 2 tests verifying phone number capture and preservation during rental
Controller Tests
src/test/kotlin/upbrella/be/rent/controller/RentControllerTest.kt, src/test/kotlin/upbrella/be/user/controller/UserControllerTest.kt
Wires HttpSession into rent form test; adds hasPhoneNumber to test responses; marks phoneNumber as optional in API documentation

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Controller as RentController
    participant Service as RentService
    participant DB as Database
    
    User->>Controller: GET /rent-form/{umbrellaId}
    Controller->>Controller: Extract user from session
    Controller->>DB: Fetch user details
    DB-->>Controller: User (hasPhoneNumber: boolean)
    Controller->>Service: findRentForm(umbrellaId, user)
    Service->>DB: Fetch umbrella
    DB-->>Service: Umbrella
    Service-->>Controller: RentFormResponse {hasPhoneNumber}
    Controller-->>User: Form with phone requirement flag
    
    User->>Controller: POST /rent {phoneNumber, ...}
    Controller->>Service: addRental(umbrellaId, request)
    alt User has no phone number
        Service->>DB: UPDATE user.phoneNumber
        DB-->>Service: Success
    else User already has phone number
        Service->>Service: Skip phone update
    end
    Service->>DB: Create rental record
    DB-->>Service: Rental created
    Service-->>Controller: RentalHistoryResponse
    Controller-->>User: Rental confirmed
Loading

Estimated code review effort

๐ŸŽฏ 3 (Moderate) | โฑ๏ธ ~25 minutes

Possibly related PRs

Suggested reviewers

  • acceptor-gyu

Poem

๐Ÿฐ Hops with glee at rental time,
Phone numbers now collected sublime,
No signup fuss, just "umbrellas, please!"
Then share your digits with such ease,
One call away, your rain's in the clear! โ˜”

๐Ÿšฅ Pre-merge checks | โœ… 1 | โŒ 2
โŒ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage โš ๏ธ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check โ“ Inconclusive The title 'Feature/505' is vague and generic, referencing only an issue number without describing the actual change made in the changeset. Provide a descriptive title that summarizes the main change, such as 'Make user phone number optional at signup, required at rental' or 'Move phone number collection from signup to rental flow'.
โœ… Passed checks (1 passed)
Check name Status Explanation
Description Check โœ… Passed Check skipped - CodeRabbitโ€™s high-level summary is enabled.

โœ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.

โœจ Finishing touches
  • ๐Ÿ“ Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and canโ€™t be posted inline due to platform limitations.

โš ๏ธ Outside diff range comments (1)
src/test/kotlin/upbrella/be/user/controller/UserControllerTest.kt (1)

108-109: Mark phoneNumber as optional in the API documentation.

Since phoneNumber is now nullable (as reflected in UserInfoResponse and the broader PR changes), it should be marked as .optional() in the response field documentation, consistent with the join request documentation on Line 372.

๐Ÿ“ Proposed fix
                        fieldWithPath("phoneNumber").type(JsonFieldType.STRING)
-                            .description("์‚ฌ์šฉ์ž ์ „ํ™”๋ฒˆํ˜ธ"),
+                            .description("์‚ฌ์šฉ์ž ์ „ํ™”๋ฒˆํ˜ธ")
+                            .optional(),
๐Ÿค– Fix all issues with AI agents
In @src/main/kotlin/upbrella/be/rent/dto/request/RentUmbrellaByUserRequest.kt:
- Around line 15-18: The phoneNumber property in RentUmbrellaByUserRequest
currently has a default empty string which conflicts with the @NotBlank
validation; remove the "= \"\"" initializer on the val phoneNumber so the field
is required at construction (or alternatively provide a valid non-blank default
if you intend it optional), ensuring the @field:NotBlank/@field:Pattern
validations can be satisfied.
๐Ÿงน Nitpick comments (2)
src/main/kotlin/upbrella/be/user/entity/User.kt (1)

74-74: Consider using null for deleted phone numbers.

The code uses the sentinel value "deleted" to mark phone numbers of deleted/withdrawn users. While this works, consider whether null would be more idiomatic now that phoneNumber is nullable, or whether this distinction (never provided vs. deleted) is semantically important for your domain.

If the distinction matters, consider documenting this convention or using a more explicit approach (e.g., an enum or separate flag).

Also applies to: 85-85

docs/feature/505.md (1)

1-202: Excellent documentation with minor suggestion.

The feature documentation is comprehensive, well-structured, and accurately reflects the code changes. It covers all aspects including API changes, affected files, and migration considerations.

Consider updating the test case checkboxes (lines 182-193) to reflect that the tests have been implemented:

  • โœ… Test cases in RentServiceTest.kt cover phone number handling during rental
  • โœ… Test cases in UserTest.kt cover updatePhoneNumber and hasPhoneNumber methods
  • โœ… Test cases in RentControllerTest.kt cover the REST API changes
๐Ÿ“œ Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 11b2d82 and 05b06a8.

๐Ÿ“’ Files selected for processing (15)
  • docs/feature/505.md
  • src/main/kotlin/upbrella/be/rent/controller/RentController.kt
  • src/main/kotlin/upbrella/be/rent/dto/request/RentUmbrellaByUserRequest.kt
  • src/main/kotlin/upbrella/be/rent/dto/response/HistoryInfoDto.kt
  • src/main/kotlin/upbrella/be/rent/dto/response/RentFormResponse.kt
  • src/main/kotlin/upbrella/be/rent/dto/response/RentalHistoryResponse.kt
  • src/main/kotlin/upbrella/be/rent/service/RentService.kt
  • src/main/kotlin/upbrella/be/user/dto/request/JoinRequest.kt
  • src/main/kotlin/upbrella/be/user/dto/response/SingleUserInfoResponse.kt
  • src/main/kotlin/upbrella/be/user/dto/response/UserInfoResponse.kt
  • src/main/kotlin/upbrella/be/user/entity/User.kt
  • src/test/kotlin/upbrella/be/rent/controller/RentControllerTest.kt
  • src/test/kotlin/upbrella/be/rent/service/RentServiceTest.kt
  • src/test/kotlin/upbrella/be/user/controller/UserControllerTest.kt
  • src/test/kotlin/upbrella/be/user/entity/UserTest.kt
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
๐Ÿ”‡ Additional comments (23)
src/test/kotlin/upbrella/be/user/controller/UserControllerTest.kt (1)

372-372: LGTM!

The phoneNumber field is correctly marked as optional in the join request documentation, aligning with the PR objective to make phone numbers optional during signup.

src/main/kotlin/upbrella/be/rent/controller/RentController.kt (1)

34-40: LGTM!

The method correctly retrieves the authenticated user from the session and passes it to the rent service. This enables the rent form to determine whether the user has a phone number, consistent with the PR's objective to capture phone numbers during rental.

src/main/kotlin/upbrella/be/rent/dto/response/HistoryInfoDto.kt (1)

9-9: LGTM!

The phoneNumber field is correctly updated to nullable (String?), consistent with the PR's objective to make phone numbers optional during signup. QueryDSL's @QueryProjection will handle the nullable field appropriately.

src/main/kotlin/upbrella/be/user/dto/response/SingleUserInfoResponse.kt (1)

9-9: LGTM!

The phoneNumber field is correctly updated to nullable (String?), aligning with the PR's goal of making phone numbers optional during signup. The fromUser factory method properly handles the nullable mapping.

src/main/kotlin/upbrella/be/user/dto/response/UserInfoResponse.kt (1)

8-8: LGTM! Clean nullable type update.

The phoneNumber field correctly reflects the nullable type from the User entity. The mapping logic remains sound.

src/main/kotlin/upbrella/be/user/entity/User.kt (3)

17-17: LGTM! Appropriate nullable field declaration.

Making phoneNumber nullable with a default of null correctly supports the optional phone number flow during signup.


106-108: LGTM! Clean phone number update method.

The method correctly accepts a non-null phone number and updates the entity. Validation at the service layer (via RentUmbrellaByUserRequest) ensures valid input.


110-112: LGTM! Robust phone number presence check.

Using isNullOrBlank() correctly handles null, empty strings, and whitespace-only values. This provides a reliable predicate for the rental flow's phone number collection logic.

src/main/kotlin/upbrella/be/rent/dto/response/RentalHistoryResponse.kt (1)

9-9: LGTM! Consistent nullable type propagation.

The phoneNumber field correctly reflects nullable types across the rental history response chain. Both factory methods properly handle the nullable assignment.

src/main/kotlin/upbrella/be/rent/dto/response/RentFormResponse.kt (1)

10-10: LGTM! Well-designed progressive data collection.

The hasPhoneNumber field enables the rental flow to conditionally collect phone numbers only when needed. This improves the user experience by deferring optional data collection to the point where it becomes required.

The factory method cleanly integrates with User.hasPhoneNumber() to determine the flag value.

Also applies to: 13-13, 19-19

src/main/kotlin/upbrella/be/user/dto/request/JoinRequest.kt (1)

12-14: No changes needed.

The nullable phoneNumber field with @Pattern and @Size validators follows correct Bean Validation semantics. When phoneNumber is null, both validators are skipped by default per JSR-303 specification, allowing optional submission. When provided, @Pattern enforces the format ^\d{3}-?\d{4}-?\d{4}$, and @Size limits to 16 characters. The controller applies @Valid on the JoinRequest parameter, ensuring validation is triggered. The implementation is sound.

src/test/kotlin/upbrella/be/rent/service/RentServiceTest.kt (3)

98-99: LGTM!

The setUp correctly initializes the new conditionReport and phoneNumber fields in RentUmbrellaByUserRequest to support the phone number collection flow during rental.


262-289: LGTM!

The test correctly verifies that existing phone numbers are preserved during rental, ensuring the service doesn't overwrite a user's existing phone number.


233-260: Verify that the User's phone number update is actually persisted to the database.

The service correctly relies on JPA dirty checking via @Transactional to persist the phoneNumber change. However, the test uses a detached User entity created manually, which won't be managed by the persistence context. The assertion only verifies the in-memory state. Consider adding a verification that the User is explicitly saved or loaded from the database to confirm the change persists beyond the transaction scope.

src/test/kotlin/upbrella/be/rent/controller/RentControllerTest.kt (3)

82-118: LGTM!

The test correctly implements session-based authentication and properly wires the user retrieval flow. The SessionUser id matches the userReader mock, and the User entity is correctly passed to findRentForm.


103-143: LGTM!

The hasPhoneNumber field is correctly added to RentFormResponse and properly documented in REST Docs, enabling the frontend to conditionally display phone number input fields.


240-291: LGTM!

The phoneNumber field is correctly added to RentUmbrellaByUserRequest and properly documented as a required field in REST Docs, aligning with the new rental flow requirements.

src/test/kotlin/upbrella/be/user/entity/UserTest.kt (4)

170-190: LGTM!

The test correctly verifies that updatePhoneNumber successfully updates a null phone number to the provided value.


192-209: LGTM!

The test correctly verifies that hasPhoneNumber() returns true when a user has a non-null, non-empty phone number.


211-228: LGTM!

The test correctly verifies that hasPhoneNumber() returns false when a user has a null phone number.


230-247: LGTM!

The test correctly verifies that hasPhoneNumber() returns false for empty strings, ensuring robust validation of phone number presence.

src/main/kotlin/upbrella/be/rent/service/RentService.kt (2)

68-71: LGTM!

The phone number update logic correctly populates the user's phone number only when absent, preserving existing phone numbers. This design ensures first-time renters capture their phone number while preventing accidental overwrites for existing users.


44-49: All callers of findRentForm have been properly updated to pass the User parameter. The breaking change has been correctly applied across the codebase:

  • Controller invocation: rentService.findRentForm(umbrellaId, userToRent) โœ“
  • Test mock: rentService.findRentForm(2L, userToRent) โœ“

Comment on lines +15 to +18
@field:NotBlank(message = "์ „ํ™”๋ฒˆํ˜ธ๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
@field:Size(max = 16)
@field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "์œ ํšจํ•œ ์ „ํ™”๋ฒˆํ˜ธ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค.")
val phoneNumber: String = ""
Copy link

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue | ๐ŸŸก Minor

Remove the default value or reconsider the validation.

The default value of "" (empty string) conflicts with the @NotBlank validation, 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

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@field:NotBlank(message = "์ „ํ™”๋ฒˆํ˜ธ๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
@field:Size(max = 16)
@field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "์œ ํšจํ•œ ์ „ํ™”๋ฒˆํ˜ธ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค.")
val phoneNumber: String = ""
@field:NotBlank(message = "์ „ํ™”๋ฒˆํ˜ธ๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.")
@field:Size(max = 16)
@field:Pattern(regexp = "^\\d{3}-?\\d{4}-?\\d{4}$", message = "์œ ํšจํ•œ ์ „ํ™”๋ฒˆํ˜ธ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค.")
val phoneNumber: String
๐Ÿค– Prompt for AI Agents
In @src/main/kotlin/upbrella/be/rent/dto/request/RentUmbrellaByUserRequest.kt
around lines 15 - 18, The phoneNumber property in RentUmbrellaByUserRequest
currently has a default empty string which conflicts with the @NotBlank
validation; remove the "= \"\"" initializer on the val phoneNumber so the field
is required at construction (or alternatively provide a valid non-blank default
if you intend it optional), ensuring the @field:NotBlank/@field:Pattern
validations can be satisfied.

@birdieHyun birdieHyun merged commit fdba801 into dev Jan 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants