Skip to content

아바타 생성시 garden 연결#113

Merged
lejuho merged 1 commit into
developfrom
chore/garden-connect
Aug 26, 2025
Merged

아바타 생성시 garden 연결#113
lejuho merged 1 commit into
developfrom
chore/garden-connect

Conversation

@lejuho
Copy link
Copy Markdown
Collaborator

@lejuho lejuho commented Aug 26, 2025

ㄱㄱㄱ

Summary by CodeRabbit

  • 신기능
    • 아바타 생성 시, 사용자 단계(위시트리 단계)에 따른 최대 정원 수 한도 내에서 자동으로 새 정원이 배치됩니다. 한도를 초과하면 생성이 차단됩니다.
    • 단계별 최대 정원 수 규칙이 추가되어, 단계가 올라갈수록 보유 가능한 정원이 증가합니다.
    • 최대 정원 수에 도달한 경우 사용자에게 안내되는 오류 코드가 추가되어, 한도 상황을 명확히 인지할 수 있습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

아바타 생성 이후의 처리 로직을 확장해 위시트리 단계별 최대 정원 수를 검사하고, 여유가 있으면 새 정원을 생성·연결, 한도 도달 시 오류를 발생시키도록 추가했습니다. 이를 위해 WishTreeStage에 maxGardens를 도입하고, ErrorCode에 MAX_GARDENS_REACHED를 추가했습니다.

Changes

Cohort / File(s) Summary
Avatar 서비스 확장
src/main/java/.../domain/avatar/avatar/service/AvatarService.java
WishTree, Garden 관련 리포지토리 주입 추가. 아바타 생성 후 사용자의 WishTree 단계 확인 → maxGardens 산출 → 현재 정원 수 비교 → 여유 시 Garden 생성/저장, 초과 시 MAX_GARDENS_REACHED 예외 발생.
WishTree 단계별 최대 정원 수 도입
src/main/java/.../domain/mission/wishTree/WishTreeStage.java
enum 상수에 maxGardens(각 1–5) 추가. 새 필드 private final int maxGardens. 3인자 생성자 형태로 상수 갱신. 보조 접근자 public int getMaxGardens(WishTreeStage stage) 추가.
에러 코드 추가
src/main/java/.../global/common/ErrorCode.java
새 상수 MAX_GARDENS_REACHED(HttpStatus.BAD_REQUEST, "E-50008", "...") 추가. 이전 마지막 항목의 세미콜론을 콤마로 수정.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant AS as AvatarService
  participant AR as AvatarRepository
  participant WR as WishTreeRepository
  participant GR as GardenRepository

  U->>AS: createAvatar(userId, nickname, imageUrl, masterId)
  AS->>AR: save(new Avatar)
  AR-->>AS: newAvatar

  AS->>WR: findByUserId(userId)
  WR-->>AS: wishTree (or null)

  alt WishTree not found
    AS-->>U: throw NOT_FOUND (WishTree)
  else WishTree found
    AS->>AS: stage = wishTree.getStage()\nmax = stage.getMaxGardens(stage)
    AS->>AS: current = user.getGardens().size()
    alt current < max
      AS->>GR: save(new Garden(user, newAvatar, slot=current+1))
      GR-->>AS: saved Garden
      AS-->>U: return (created)
    else max reached
      AS-->>U: throw MAX_GARDENS_REACHED
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

새싹이 속삭여, “정원은 아직 한 칸 더!”
꽃은 두 칸, 열매 셋—토끼는 발끝으로 셈을 해요.
나무는 넷, 최종 다섯, 규칙은 초록 잎에 적혀 있고,
새 아바타가 오면 흙을 고이 펴 줍니다.
꽉 찼다면? 깡충—“다음 레벨에서 만나!” 🌱🐇🌳

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ef96081 and d8335dd.

📒 Files selected for processing (3)
  • src/main/java/com/example/cp_main_be/domain/avatar/avatar/service/AvatarService.java (3 hunks)
  • src/main/java/com/example/cp_main_be/domain/mission/wishTree/WishTreeStage.java (2 hunks)
  • src/main/java/com/example/cp_main_be/global/common/ErrorCode.java (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/garden-connect

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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.

1 participant