Skip to content

refactor: id를 postId로 통일 및 이미지 조회 로직 수정#147

Merged
yooooonshine merged 2 commits intodevelopfrom
feature/146-unify-id
Aug 24, 2025
Merged

refactor: id를 postId로 통일 및 이미지 조회 로직 수정#147
yooooonshine merged 2 commits intodevelopfrom
feature/146-unify-id

Conversation

@yooooonshine
Copy link
Contributor

@yooooonshine yooooonshine commented Aug 24, 2025

개요

프론트엔드 요청에 따라 응답 DTO의 id 필드를 postId로 통일하고, 이미지 조회 로직을 개선했습니다.

작업사항

  • Post 응답 DTO 필드 통일:

    • GetPostResponseGetPostsResponseidpostId로 변경
    • 프론트엔드에서 요청한 필드명 통일 적용
  • 이미지 조회 로직 개선:

    • 기존 PR에서 변경된 createImageGetUrl 사용 로직 반영
    • 이미지 URL 생성 방식 통일
  • 테스트 코드 업데이트:

    • 변경된 필드명에 맞게 관련 테스트 코드 수정
    • PostServiceTest, PostControllerTest, PublicPostControllerTest 업데이트

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • 공개/일반 게시글 API 응답에서 식별자 필드명을 id → postId로 변경했습니다. 호환성 영향: 클라이언트는 필드명 참조를 postId로 업데이트해야 합니다.
    • 게시글 이미지 응답을 엔터티 노출 대신 표준화된 Image DTO로 제공하며, 각 이미지에 접근 가능한 URL을 포함합니다.
    • 그 외 응답 구조와 데이터(제목, 설명, 가격, 좋아요 수 등)는 동일하며 기능 동작에는 변경이 없습니다.

- 기존 PR에서 이미지 조회로직이 createImageGetUrl을 사용하도록 변경됨
- 기존 PR에서 변경된 사항이 반영되지 않아 수정
- 프론트에서 id를 postId 등으로 형식통일해달라고 요청하여 수정
@yooooonshine yooooonshine linked an issue Aug 24, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Aug 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

게시글 단건/목록 응답에서 식별자 필드명을 id→postId로 변경했고, 공개용 조회 서비스에서 이미지 목록을 엔티티 대신 ImageDto로 매핑하도록 수정했습니다. 관련 테스트는 필드명 변경과 이미지 URL 생성 로직(imageUtil 기반)에 맞춰 단정문을 갱신했습니다.

Changes

Cohort / File(s) Change Summary
Service: 공개 글 조회 매핑 조정
src/main/java/.../post/service/PostService.java
getPostForPublic에서 이미지 반환을 List<PostImageEntity>List<ImageDto>로 변경. imageUtil.createImageGetUrl(image.getImagePath())image.getId()로 DTO 매핑. 나머지 로직은 동일.
DTO: 식별자 필드명 변경(단건/목록)
src/main/java/.../dto/response/GetPostResponse.java, src/main/java/.../dto/response/GetPostsResponse.java
공개 레코드의 첫 필드를 idpostId로 변경. 시그니처 업데이트 외 로직 변화 없음. 팩토리/생성부는 postEntity.getId()postId에 매핑.
Tests: 서비스/컨트롤러 단정 갱신
src/test/java/.../post/service/PostServiceTest.java, src/test/java/.../post/controller/PostControllerTest.java, src/test/java/.../post/controller/PublicPostControllerTest.java
단정에서 id()/data.idpostId()/data.postId로 교체. 이미지 URL 기대값을 imageUtil.createImageGetUrl(image.getImagePath()) 기반으로 수정. 불필요한 import 제거.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as PostController
  participant S as PostService
  participant R as PostRepository
  participant IR as ImageRepository
  participant U as ImageUtil

  C->>S: getPostForPublic(postId, currentUser)
  S->>R: findPostWithRelations(postId)
  R-->>S: PostEntity(+ PostImageEntity list)
  loop map images
    S->>U: createImageGetUrl(imagePath)
    U-->>S: publicImageUrl
    S->>S: new ImageDto(publicImageUrl, imageId)
  end
  S-->>C: GetPostResponse(postId, ..., images: List<ImageDto>, likeCount, isLiked)
  C-->>Caller: 200 OK + body
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

귀가 쫑긋, 필드가 바뀌었지—postId!
엔티티 대신 DTO, 깔끔한 이미지 🎞️
URL은 유틸로 척척 이어 붙이고,
테스트도 척 맞춰 폴짝폴짝 뛰고,
오늘도 커밋밭에서 당근 하나 추가! 🥕

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 c94332f and 7a55dd4.

📒 Files selected for processing (6)
  • src/main/java/hanium/modic/backend/domain/post/service/PostService.java (1 hunks)
  • src/main/java/hanium/modic/backend/web/post/dto/response/GetPostResponse.java (1 hunks)
  • src/main/java/hanium/modic/backend/web/post/dto/response/GetPostsResponse.java (1 hunks)
  • src/test/java/hanium/modic/backend/domain/post/service/PostServiceTest.java (3 hunks)
  • src/test/java/hanium/modic/backend/web/post/controller/PostControllerTest.java (1 hunks)
  • src/test/java/hanium/modic/backend/web/post/controller/PublicPostControllerTest.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/146-unify-id

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.

[/api/profiles/me] User 객체의 id 속성이 필요합니다

1 participant