Skip to content

Conversation

@choyeseol
Copy link
Contributor

@choyeseol choyeseol commented Jul 30, 2025

#️⃣연관된 이슈

#10

🔀반영 브랜치

feat/#10-codeRabbit-test -> 없음

🔧변경 사항

  • groupController와 CommandGroupService에 테스트용 코드 추가했습니다.
  • 머지 없이 브랜치 삭제 예정

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요

Summary by CodeRabbit

  • 신규 기능
    • 그룹 토큰을 이용해 그룹 정보를 조회할 수 있는 새로운 GET 엔드포인트(/api/v1/group/get)가 추가되었습니다.
  • 기타
    • 내부 서비스 및 설정이 업데이트되었습니다.

@choyeseol choyeseol self-assigned this Jul 30, 2025
@choyeseol choyeseol linked an issue Jul 30, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jul 30, 2025

Walkthrough

새로운 GET 엔드포인트 /api/v1/group/getGroupController에 추가되었습니다. 이 엔드포인트는 groupToken 파라미터를 받아 토큰으로 그룹 ID를 조회하고, 해당 ID로 그룹 엔티티를 반환합니다. 이를 위해 CommandGroupService에 그룹 ID로 엔티티를 조회하는 메서드가 추가되었습니다. 또한, config 파일의 서브프로젝트 커밋 참조가 갱신되었습니다.

Changes

Cohort / File(s) Change Summary
GroupController 엔드포인트 추가
src/main/java/com/dnd/moddo/domain/group/controller/GroupController.java
/api/v1/group/get GET 엔드포인트 추가, 그룹 토큰으로 그룹 엔티티 반환 로직 구현 및 관련 import 추가
CommandGroupService 메서드 추가
src/main/java/com/dnd/moddo/domain/group/service/CommandGroupService.java
GroupRepository 의존성 주입 및 그룹 ID로 엔티티 조회하는 read(Long groupId) 메서드 추가
Config 커밋 참조 갱신
src/main/resources/config
서브프로젝트 커밋 해시를 최신 값으로 변경

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GroupController
    participant QueryGroupService
    participant CommandGroupService
    participant GroupRepository

    Client->>GroupController: GET /api/v1/group/get?groupToken=...
    GroupController->>QueryGroupService: findGroupIdByToken(groupToken)
    QueryGroupService-->>GroupController: groupId
    GroupController->>CommandGroupService: read(groupId)
    CommandGroupService->>GroupRepository: getById(groupId)
    GroupRepository-->>CommandGroupService: Group
    CommandGroupService-->>GroupController: Group
    GroupController-->>Client: 200 OK + Group
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

새로 온 그룹 토큰의 길,
GET 엔드포인트로 토실토실!
서비스 따라 그룹 찾아,
토큰에서 ID로, ID에서 그룹으로.
커밋 해시도 살짝 바꿔,
오늘도 깡총깡총 리뷰 끝! 🐰✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


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 sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for 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.

@github-actions
Copy link

📝 테스트 커버리지 리포트입니다!

File Coverage [92.06%] 🍏
CommandGroupService.java 92.06% 🍏
Total Project Coverage 92.57% 🍏

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b4e7fc and a32cae5.

📒 Files selected for processing (3)
  • src/main/java/com/dnd/moddo/domain/group/controller/GroupController.java (2 hunks)
  • src/main/java/com/dnd/moddo/domain/group/service/CommandGroupService.java (3 hunks)
  • src/main/resources/config (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/main/resources/config (1)

Learnt from: sudhdkso
PR: #5
File: src/main/java/com/dnd/moddo/global/config/KakaoProperties.java:5-13
Timestamp: 2025-07-15T06:25:52.363Z
Learning: The project uses git submodules for configuration management (src/main/resources/config), where sensitive values like Kakao adminKey and clientId are managed separately from the main codebase for security purposes.

🧬 Code Graph Analysis (1)
src/main/java/com/dnd/moddo/domain/group/controller/GroupController.java (3)
src/main/java/com/dnd/moddo/domain/character/controller/CharacterController.java (2)
  • CharacterController (16-34)
  • getCharacter (25-33)
src/test/java/com/dnd/moddo/domain/group/controller/GroupControllerTest.java (2)
  • getGroup (72-89)
  • GroupControllerTest (28-126)
src/main/java/com/dnd/moddo/domain/groupMember/controller/GroupMemberController.java (1)
  • getGroupMembers (35-42)
🔇 Additional comments (3)
src/main/java/com/dnd/moddo/domain/group/service/CommandGroupService.java (1)

3-3: GroupRepository 의존성 추가가 적절합니다.

새로운 의존성 주입이 올바르게 구현되었습니다.

Also applies to: 34-34

src/main/java/com/dnd/moddo/domain/group/controller/GroupController.java (1)

3-3: Group 엔티티 임포트가 적절합니다.

새로운 엔드포인트를 위한 필요한 임포트입니다.

src/main/resources/config (1)

1-1: src/main/resources/config 서브모듈 접근 실패: URL 및 커밋 확인 필요
CI 파이프라인에서 아래 스크립트를 실행한 결과, 원격 레포지토리 클론에 실패하여 커밋 존재 여부를 검증할 수 없었습니다.

git submodule update --init --recursive
# → 오류: https://github.com/sudhdkso/moddo-infra-config.git 레포지토리를 찾을 수 없음
git submodule status src/main/resources/config
# → -6515d7b8afc3d52cef1f35923ab9cf0429b9302e

확인 및 조치 사항:

  • .gitmodules에 설정된 URL(https://github.com/sudhdkso/moddo-infra-config.git) 이 올바른지, 또는 SSH(URL, 권한) 로 접근해야 하는지 점검
  • 서브모듈 레포지토리가 private일 경우, CI 에서 사용할 인증 방식(Token/SSH 키) 설정
  • 원격 레포지토리에 커밋 6515d7b8afc3d52cef1f35923ab9cf0429b9302e 가 실제로 존재하는지 확인

위 내용을 검토한 뒤, 올바른 서브모듈 URL 및 커밋으로 업데이트 부탁드립니다.

Comment on lines +97 to +103
@GetMapping("/get")
public ResponseEntity<Group> groupGet(
@RequestParam("groupToken") String code) {
Long groupId = queryGroupService.findIdByCode(code);
Group response = commandGroupService.read(groupId);
return ResponseEntity.ok(response);
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

엔티티 직접 반환과 인증 누락 문제가 있습니다.

이 엔드포인트에는 몇 가지 개선이 필요한 부분이 있습니다:

  1. 엔티티 직접 반환: Group 엔티티를 직접 반환하면 내부 구조가 노출됩니다.
  2. 인증 누락: 다른 엔드포인트와 달리 HttpServletRequest와 인증 로직이 없습니다.
  3. 엔드포인트 경로: /get은 명확하지 않은 경로명입니다.

다음과 같이 수정하는 것을 권장합니다:

 @GetMapping("/get")
-public ResponseEntity<Group> groupGet(
-        @RequestParam("groupToken") String code) {
+public ResponseEntity<GroupResponse> groupGet(
+        HttpServletRequest request,
+        @RequestParam("groupToken") String code) {
+    Long userId = jwtService.getUserId(request);
     Long groupId = queryGroupService.findIdByCode(code);
-    Group response = commandGroupService.read(groupId);
+    GroupResponse response = queryGroupService.findOne(groupId, userId);
     return ResponseEntity.ok(response);
 }

또는 기존 getGroup() 메서드와 중복되므로 제거를 고려해보세요.

📝 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
@GetMapping("/get")
public ResponseEntity<Group> groupGet(
@RequestParam("groupToken") String code) {
Long groupId = queryGroupService.findIdByCode(code);
Group response = commandGroupService.read(groupId);
return ResponseEntity.ok(response);
}
@GetMapping("/get")
public ResponseEntity<GroupResponse> groupGet(
HttpServletRequest request,
@RequestParam("groupToken") String code) {
// 인증된 사용자 ID 조회
Long userId = jwtService.getUserId(request);
// 토큰으로 그룹 ID 조회
Long groupId = queryGroupService.findIdByCode(code);
// 사용자 권한 검증을 포함해 DTO 반환
GroupResponse response = queryGroupService.findOne(groupId, userId);
return ResponseEntity.ok(response);
}
🤖 Prompt for AI Agents
In src/main/java/com/dnd/moddo/domain/group/controller/GroupController.java
around lines 97 to 103, the method directly returns the Group entity, lacks
authentication handling, and uses an unclear endpoint path "/get". To fix this,
replace the direct entity return with a DTO that exposes only necessary data,
add HttpServletRequest parameter and implement authentication checks consistent
with other endpoints, and rename the endpoint to a more descriptive path or
consider removing this method if it duplicates existing functionality like
getGroup().

Comment on lines +56 to +58
public Group read(Long groupId) {
return groupRepository.getById(groupId);
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

getById() 사용 시 잠재적 문제점이 있습니다.

groupRepository.getById(groupId)는 엔티티가 존재하지 않을 때 LazyInitializationException을 발생시킬 수 있습니다. 더 안전한 방법을 사용하는 것을 권장합니다.

다음 중 하나의 방법으로 수정하는 것을 권장합니다:

 public Group read(Long groupId) {
-    return groupRepository.getById(groupId);
+    return groupRepository.findById(groupId)
+        .orElseThrow(() -> new EntityNotFoundException("Group not found with id: " + groupId));
 }

또는 기존 GroupReader를 활용:

 public Group read(Long groupId) {
-    return groupRepository.getById(groupId);
+    return groupReader.read(groupId);
 }
📝 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
public Group read(Long groupId) {
return groupRepository.getById(groupId);
}
public Group read(Long groupId) {
return groupRepository.findById(groupId)
.orElseThrow(() -> new EntityNotFoundException("Group not found with id: " + groupId));
}
🤖 Prompt for AI Agents
In src/main/java/com/dnd/moddo/domain/group/service/CommandGroupService.java
around lines 56 to 58, replace the use of groupRepository.getById(groupId) with
a safer alternative like groupRepository.findById(groupId) that returns an
Optional to avoid LazyInitializationException when the entity does not exist.
Alternatively, use the existing GroupReader component if available to safely
retrieve the Group entity. Adjust the method to handle the Optional properly or
delegate to GroupReader to ensure safe entity access.

@choyeseol choyeseol closed this Jul 30, 2025
@choyeseol choyeseol deleted the feat/#10-codeRabbit-test branch July 30, 2025 01:28
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.

코드래빗 테스트

2 participants