Skip to content

[Feat/add egg type to response] - 응답필드 추가#106

Merged
ekgns33 merged 4 commits intomainfrom
feat/add-egg-type-to-response
Jul 2, 2025
Merged

[Feat/add egg type to response] - 응답필드 추가#106
ekgns33 merged 4 commits intomainfrom
feat/add-egg-type-to-response

Conversation

@ekgns33
Copy link
Contributor

@ekgns33 ekgns33 commented Jul 2, 2025

작업 내역

  • 화면 요구사항이 변하면서 Egg_type도 전해줘야하는 이슈 발생
  • 회원가입, 부화중인 알에 필드 추가

Summary by CodeRabbit

  • New Features

    • Added the egg type code to user signup responses, hatch egg responses, and incubating egg views, allowing users to see the specific code of the egg they receive or interact with.
  • Bug Fixes

    • Updated tests to validate the presence of the new egg type code field in relevant API responses.

@ekgns33 ekgns33 self-assigned this Jul 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

The changes introduce a new eggCode field to several response and view objects related to user signup, egg hatching, and incubating eggs. Constructors, queries, and tests are updated to handle this new field, ensuring the egg type code is included in relevant responses and projections throughout the authentication and hatch flows.

Changes

File(s) Change Summary
.../auth/service/SignUpUsecaseImpl.java Retrieves EggType from granted egg and passes its code to SignupUserResponse.
.../auth/service/dto/SignupUserResponse.java Adds eggCode field and updates constructors to include it.
.../hatch/service/dto/HatchEggResponse.java Adds eggCode field with Swagger schema to the response record.
.../hatch/service/usecase/HatchUsecaseImpl.java Updates HatchEggResponse constructor call to pass egg type code.
.../user/repository/IncubatingEggRepository.java Modifies JPQL query to include eggType.code in IncubatingEggView projection.
.../user/service/dto/IncubatingEggView.java Adds eggCode field and updates constructor to accept it.
.../auth/controller/AuthControllerTest.java Updates signup response mocks and assertions to include and verify the new egg_code field.
.../hatch/controller/HatchControllerTest.java Adds assertion for non-null egg_code in hatch response payload.
.../user/api/UserItemAcceptanceTest.java Updates test mock to include "ECODE" as the eggCode in SignupUserResponse.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AuthService
    participant EggGrantService
    participant SignupUserResponse

    User->>AuthService: Register (signup)
    AuthService->>EggGrantService: grantGreetingEggToUser(savedUser)
    EggGrantService-->>AuthService: Egg (with EggType)
    AuthService->>SignupUserResponse: Construct with user, tokenPair, egg, eggType.code
    SignupUserResponse-->>User: Response includes eggCode
Loading
sequenceDiagram
    participant User
    participant HatchService
    participant IncubatingEggRepository
    participant HatchEggResponse

    User->>HatchService: Hatch Egg
    HatchService->>IncubatingEggRepository: Find incubating egg (with eggType.code)
    IncubatingEggRepository-->>HatchService: IncubatingEggView (with eggCode)
    HatchService->>HatchEggResponse: Construct with eggCode and other data
    HatchEggResponse-->>User: Response includes eggCode
Loading

Suggested labels

:rocket: feature :rocket:

Poem

🥚 A code for each egg, now part of the show,
When you sign up or hatch, it’s there in the flow.
From records to tests, the field’s in the nest,
With “ECODE” in tow, our system’s refreshed!
🐰✨ Hooray for the eggs with a code on their chest!

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 0

🧹 Nitpick comments (2)
src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java (1)

151-152: Consider using a more descriptive test value for eggCode.

The addition of the "ECODE" parameter correctly updates the mock to match the new SignupUserResponse constructor. However, consider using a more descriptive test value that better represents an actual egg code format.

-                "test.url",
-                "ECODE"
+                "test.url",
+                "EGG_001"
src/test/java/org/runimo/runimo/auth/controller/AuthControllerTest.java (1)

154-162: Consider adding egg_code assertion to both signup tests for consistency.

Both test methods mock SignupUserResponse with the new eggCode parameter, but only the first test (회원가입_디바이스_토큰_없음_201응답) asserts the egg_code field in the response. For comprehensive test coverage, consider adding the assertion to the second test as well.

Add this assertion to the second test method:

 mockMvc.perform(
         multipart("/api/v1/auth/signup")
             .param("request",
                 "{\"registerToken\":\"valid-token\", \"nickname\":\"RunimoUser\", \"deviceToken\":\"valid_device_token\", \"devicePlatform\":\"FCM\"}"))
     .andExpect(status().isCreated())
+    .andExpect(jsonPath("$.payload.egg_code").value("ECODE"))
     .andExpect(jsonPath("$.code").value(UserHttpResponseCode.SIGNUP_SUCCESS.getCode()));

Also applies to: 193-201

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8fb1a and 1e3d661.

📒 Files selected for processing (9)
  • src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java (2 hunks)
  • src/main/java/org/runimo/runimo/auth/service/dto/SignupUserResponse.java (1 hunks)
  • src/main/java/org/runimo/runimo/hatch/service/dto/HatchEggResponse.java (1 hunks)
  • src/main/java/org/runimo/runimo/hatch/service/usecase/HatchUsecaseImpl.java (1 hunks)
  • src/main/java/org/runimo/runimo/user/repository/IncubatingEggRepository.java (1 hunks)
  • src/main/java/org/runimo/runimo/user/service/dto/IncubatingEggView.java (1 hunks)
  • src/test/java/org/runimo/runimo/auth/controller/AuthControllerTest.java (3 hunks)
  • src/test/java/org/runimo/runimo/hatch/controller/HatchControllerTest.java (1 hunks)
  • src/test/java/org/runimo/runimo/user/api/UserItemAcceptanceTest.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and analyze
🔇 Additional comments (9)
src/test/java/org/runimo/runimo/hatch/controller/HatchControllerTest.java (1)

74-74: LGTM! Test properly validates the new egg_code field.

The addition of the egg_code validation ensures the hatch response includes the required egg type information as per the PR requirements.

src/main/java/org/runimo/runimo/hatch/service/usecase/HatchUsecaseImpl.java (1)

58-59: LGTM! Properly adds egg code to hatch response.

The implementation correctly retrieves the egg type code from the egg domain object and includes it in the HatchEggResponse, fulfilling the PR requirement to add egg type information to hatch responses.

src/main/java/org/runimo/runimo/hatch/service/dto/HatchEggResponse.java (1)

22-23: LGTM! Well-documented addition of eggCode field.

The new eggCode field is properly added with appropriate Swagger documentation, consistent naming, and correct positioning in the record.

src/main/java/org/runimo/runimo/auth/service/SignUpUsecaseImpl.java (3)

15-15: LGTM! Proper import addition for EggType.

The import is correctly added to support the new functionality.


54-54: LGTM! Clean extraction of egg type from granted egg.

The code properly extracts the EggType from the granted egg to access its code for the response.


58-58: LGTM! Correctly integrates egg code into signup response.

The implementation properly passes the egg type code to the SignupUserResponse constructor, fulfilling the PR requirement to include egg type information in user registration responses.

src/main/java/org/runimo/runimo/user/repository/IncubatingEggRepository.java (1)

29-29: LGTM! Query projection correctly updated.

The JPQL query properly adds e.eggType.code to the constructor projection, which aligns with the IncubatingEggView constructor changes. The existing join with the Egg entity allows access to the eggType.code field.

src/main/java/org/runimo/runimo/user/service/dto/IncubatingEggView.java (1)

19-19: LGTM! DTO properly updated with eggCode field.

The eggCode field addition is correctly implemented:

  • Field is properly declared and assigned in the constructor
  • Constructor signature matches the repository query projection
  • Parameter is consistently added as the last parameter for backward compatibility

Also applies to: 23-23, 30-30

src/main/java/org/runimo/runimo/auth/service/dto/SignupUserResponse.java (1)

14-14: LGTM! Record properly updated with eggCode field.

The SignupUserResponse record is correctly updated:

  • New eggCode field properly added to the record
  • Secondary constructor signature updated to accept the new parameter
  • Constructor call correctly passes the eggCode parameter
  • Consistent parameter ordering maintained

Also applies to: 17-18, 25-26

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 2, 2025

@ekgns33 ekgns33 merged commit 5fd961f into main Jul 2, 2025
4 checks passed
@ekgns33 ekgns33 deleted the feat/add-egg-type-to-response branch July 2, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant