Skip to content

feat: API 리팩토링 - 엔티티 ID 추가 및 응답 키 통일#153

Merged
yooooonshine merged 2 commits intodevelopfrom
feature/152-refactor-api
Aug 25, 2025
Merged

feat: API 리팩토링 - 엔티티 ID 추가 및 응답 키 통일#153
yooooonshine merged 2 commits intodevelopfrom
feature/152-refactor-api

Conversation

@yooooonshine
Copy link
Contributor

@yooooonshine yooooonshine commented Aug 25, 2025

개요

API 응답 구조를 개선하고 엔티티 관련 API에 ID를 추가하여 일관성을 향상시켰습니다.

작업사항

  • ✅ 엔티티 관련 API에 ID 필드 추가
  • ✅ API 응답의 키 통일 (name → userName 등)
  • ✅ 포스트 구매 기능 구현 관련 테스트 코드 수정

주요 변경사항

API 응답 구조 개선

  • 엔티티 관련 API 응답에 ID 필드 추가로 클라이언트에서 식별 가능
  • 응답 키 네이밍 통일 (name → userName 등)으로 일관성 향상

테스트 코드 개선

  • 포스트 구매 기능 구현에 따른 테스트 코드 변경 및 추가
  • 기존 테스트 오류 수정

기술적 세부사항

  • 기존 API와의 호환성을 고려하여 점진적으로 변경
  • 응답 DTO 클래스에서 필드명 통일
  • 테스트 케이스 업데이트로 안정성 확보

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 신기능

    • 내 프로필 응답에 보유 코인(coin) 추가.
    • 게시글 리뷰 댓글 응답에 댓글 ID 제공으로 식별성 강화.
  • 리팩터

    • 프로필/유저 관련 응답 스키마 정리: email/name → userEmail/userName, profileImageUrl → userImageUrl로 명확화.
    • 프로필 응답에 userId 필드 추가로 사용자 식별 정보 일관화.
    • 댓글/프로필/유저 정보 응답 필드 순서 및 명칭을 통일해 가독성 개선.
  • 테스트

    • 변경된 응답 필드명과 구조에 맞춰 통합/단위 테스트 업데이트.

- name -> userName 등으로 통일하였다.
- 엔티니관련 API에 id를 추가하였다.
@yooooonshine yooooonshine linked an issue Aug 25, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Aug 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

프로필/유저/리뷰 댓글 관련 응답 DTO에 식별자 및 필드명(userEmail/userName 등) 변경이 반영되었고, 이를 사용하는 서비스/레포지토리의 생성자 매핑과 테스트가 모두 해당 새로운 시그니처에 맞게 수정되었습니다. JPQL 프로젝션에서는 댓글 ID가 최초 인자로 추가되었습니다.

Changes

Cohort / File(s) Summary
PostReview 댓글 프로젝션/DTO
src/main/java/.../postReview/repository/PostReviewCommentRepository.java, src/main/java/.../web/postReview/dto/response/PostReviewCommentResponse.java
JPQL constructor 식 첫 인자로 c.id 추가. PostReviewCommentResponse 레코드에 postReviewCommentId(Long) 추가로 시그니처 변경.
프로필 DTO/서비스
src/main/java/.../web/profile/dto/GetMyProfileResponse.java, src/main/java/.../web/profile/dto/GetProfileResponse.java, src/main/java/.../domain/profile/service/ProfileService.java
프로필 응답 DTO에 userId, userEmail, userName 도입 및 profileImageUrluserImageUrl로 변경. 서비스에서 생성자 인자 순서/값을 user.getId() 포함하도록 수정.
유저 정보 DTO
src/main/java/.../web/user/dto/response/UserInfoResponse.java
레코드 필드 email, nameuserEmail, userName로 리네임. 팩토리 메서드 매핑은 동일한 순서 유지.
프로필 도메인/웹 테스트
src/test/java/.../domain/profile/ProfileServiceTest.java, src/test/java/.../web/profile/controller/ProfileControllerIntegrationTest.java
변경된 DTO 필드/접근자(userId, userEmail, userName, userImageUrl, coin)에 맞춰 어서션 업데이트 및 필요한 유틸 임포트 추가.
유저 도메인/웹 테스트
src/test/java/.../domain/user/service/UserServiceTest.java, src/test/java/.../web/user/controller/UserControllerIntegrationTest.java, src/test/java/.../web/user/controller/UserControllerTest.java
API 응답 필드명을 userEmail, userName으로 변경하여 어서션/JSON 경로 수정. 불필요 임포트 정리 및 DTO 임포트 추가.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

당근 한 입, 코드 한 줄 톡톡! 🥕
이름표 갈아끼우고 ID도 척척,
댓글엔 번호표, 프로필엔 새 표정.
테스트 토끼도 깡총 맞춰 뛰니,
밤하늘에 빌드 불꽃 반짝- 성공! ✨

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 b58023e and 22402dd.

📒 Files selected for processing (11)
  • src/main/java/hanium/modic/backend/domain/postReview/repository/PostReviewCommentRepository.java (1 hunks)
  • src/main/java/hanium/modic/backend/domain/profile/service/ProfileService.java (2 hunks)
  • src/main/java/hanium/modic/backend/web/postReview/dto/response/PostReviewCommentResponse.java (1 hunks)
  • src/main/java/hanium/modic/backend/web/profile/dto/GetMyProfileResponse.java (1 hunks)
  • src/main/java/hanium/modic/backend/web/profile/dto/GetProfileResponse.java (1 hunks)
  • src/main/java/hanium/modic/backend/web/user/dto/response/UserInfoResponse.java (1 hunks)
  • src/test/java/hanium/modic/backend/domain/profile/ProfileServiceTest.java (2 hunks)
  • src/test/java/hanium/modic/backend/domain/user/service/UserServiceTest.java (1 hunks)
  • src/test/java/hanium/modic/backend/web/profile/controller/ProfileControllerIntegrationTest.java (3 hunks)
  • src/test/java/hanium/modic/backend/web/user/controller/UserControllerIntegrationTest.java (2 hunks)
  • src/test/java/hanium/modic/backend/web/user/controller/UserControllerTest.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 feature/152-refactor-api

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.

@yooooonshine yooooonshine merged commit 1852edc into develop Aug 25, 2025
1 of 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.

API 개선

1 participant