Skip to content

Conversation

@leegwichan
Copy link
Member

@leegwichan leegwichan commented Jul 31, 2025

✨ 개요

  • 해당 store 가 있을 경우, storeId 값을 같이 반환
  • 해당 store 가 없을 경우, storeId 를 null 로 반환

🧾 관련 이슈

🔍 참고 사항 (선택)

Summary by CodeRabbit

  • 신규 기능

    • 스토리 상세 조회 응답에 storeId(스토어 ID) 필드가 추가되었습니다.
  • 문서화

    • API 문서에 storeId 필드가 선택적 숫자형(Nullable)으로 명시되고, 각 필드의 JSON 타입 정보가 추가되었습니다.
  • 테스트

    • storeId 필드가 존재하거나 없는 경우를 구분하여 테스트가 보강되었습니다.
    • 관련 테스트 및 검증 로직이 storeId 필드 반영에 맞게 수정되었습니다.

- 해당 store 가 있을 경우, storeId 값을 같이 반환
- 해당 store 가 없을 경우, storeId 를 null 로 반환
@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

Walkthrough

스토리 상세 조회 응답에 새로운 필드 storeId(nullable)가 추가되었습니다. 서비스 로직에서 스토리의 카카오스토어ID로 내부 Store 엔티티를 조회하여 존재 시 해당 storeId를, 없으면 null을 응답에 포함합니다. 관련 테스트와 API 문서 테스트도 이에 맞게 수정되었습니다.

Changes

Cohort / File(s) Change Summary
StoryResponse 필드 확장
src/main/java/eatda/controller/story/StoryResponse.java
@Nullable Long storeId 필드가 첫 번째 파라미터로 추가되고, @Nullable 어노테이션 import가 도입됨.
스토리 서비스 로직 수정
src/main/java/eatda/service/story/StoryService.java
StoreRepository 의존성 주입 및 getStory 메서드에서 storeId 조회 및 StoryResponse에 전달하는 로직 추가.
컨트롤러 테스트 반영
src/test/java/eatda/controller/story/StoryControllerTest.java
StoryResponse에 storeId(5L) 추가 및 storeId 검증 assertion 추가.
API 문서 테스트 및 명세 보강
src/test/java/eatda/document/story/StoryDocumentTest.java
응답 필드에 storeId(Nullable) 추가, 모든 필드의 JSON 타입 명시, 테스트 응답 생성자 storeId(null)로 변경.
서비스 단위 테스트 세분화 및 강화
src/test/java/eatda/service/story/StoryServiceTest.java
스토어ID가 없는 경우(null 반환)와 있는 경우(값 반환)로 테스트 분리 및 assertAll로 검증 강화. 기존 테스트명 변경 및 신규 테스트 추가.

Sequence Diagram(s)

sequenceDiagram
    participant Controller
    participant StoryService
    participant StoryRepository
    participant StoreRepository

    Controller->>StoryService: getStory(storyId)
    StoryService->>StoryRepository: findById(storyId)
    StoryRepository-->>StoryService: Story
    StoryService->>StoreRepository: findByKakaoId(story.storeKakaoId)
    StoreRepository-->>StoryService: Store | null
    StoryService->>Controller: StoryResponse(storeId, ...)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

released on @beta, released

Suggested reviewers

  • lvalentine6

Poem

🍃 새로운 필드가 살포시,
storeId가 추가됐지!
null일 수도, 값일 수도,
테스트도 꼼꼼히 챙겼지요.
문서도 타입도 더 친절하게,
오늘도 토끼는 귀를 쫑긋 세워
코드리뷰를 기다려요! 🐰✨

Note

⚡️ Unit Test Generation is now available in beta!

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


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 856f5cb and e1aa3bc.

📒 Files selected for processing (2)
  • src/test/java/eatda/document/story/StoryDocumentTest.java (2 hunks)
  • src/test/java/eatda/service/story/StoryServiceTest.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/test/java/eatda/document/story/StoryDocumentTest.java
  • src/test/java/eatda/service/story/StoryServiceTest.java
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/story-add-storeId

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 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.

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/eatda/document/story/StoryDocumentTest.java (1)

167-167: storeId 필드 문서화가 올바르게 추가됨

새로운 storeId 필드가 NUMBER 타입, nullable, optional로 적절히 문서화되었습니다. 다만 설명이 "가게의 카카오 ID"로 되어 있는데, 실제로는 내부 store ID를 의미하므로 설명 수정이 필요합니다.

-                        fieldWithPath("storeId").type(NUMBER).description("가게의 카카오 ID (nullable)").optional(),
+                        fieldWithPath("storeId").type(NUMBER).description("가게의 내부 ID (nullable)").optional(),
src/test/java/eatda/service/story/StoryServiceTest.java (1)

179-179: 불필요한 세미콜론 제거 필요

Line 179에 불필요한 세미콜론이 있습니다.

-            );
-            ;
+            );
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d4bee8 and 856f5cb.

📒 Files selected for processing (5)
  • src/main/java/eatda/controller/story/StoryResponse.java (2 hunks)
  • src/main/java/eatda/service/story/StoryService.java (3 hunks)
  • src/test/java/eatda/controller/story/StoryControllerTest.java (2 hunks)
  • src/test/java/eatda/document/story/StoryDocumentTest.java (2 hunks)
  • src/test/java/eatda/service/story/StoryServiceTest.java (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in story.java, the validatestoreroadaddress method only checks for null (not blank) because the kaka...
Learnt from: leegwichan
PR: YAPP-Github/26th-Web-Team-1-BE#101
File: src/main/java/eatda/domain/story/Story.java:126-130
Timestamp: 2025-07-23T11:19:46.968Z
Learning: In Story.java, the validateStoreRoadAddress method only checks for null (not blank) because the Kakao API can legitimately return empty strings for roadAddress values in certain cases, so blank road addresses should be allowed.

Applied to files:

  • src/main/java/eatda/controller/story/StoryResponse.java
  • src/main/java/eatda/service/story/StoryService.java
  • src/test/java/eatda/service/story/StoryServiceTest.java
  • src/test/java/eatda/controller/story/StoryControllerTest.java
  • src/test/java/eatda/document/story/StoryDocumentTest.java
🔇 Additional comments (13)
src/test/java/eatda/controller/story/StoryControllerTest.java (2)

92-103: 테스트 모의 객체가 새로운 storeId 필드를 올바르게 반영함

StoryResponse 생성자에 storeId(5L)가 첫 번째 파라미터로 올바르게 추가되었습니다.


114-114: storeId 필드에 대한 assertion이 적절히 추가됨

새로 추가된 storeId 필드에 대한 검증이 올바르게 구현되었습니다.

src/main/java/eatda/controller/story/StoryResponse.java (2)

3-3: @nullable 어노테이션 import가 적절히 추가됨

새로운 nullable storeId 필드를 위한 어노테이션 import가 올바르게 추가되었습니다.


6-6: storeId 필드가 올바르게 추가됨

@nullable Long storeId 필드가 첫 번째 파라미터로 적절히 추가되었으며, nullable 어노테이션도 올바르게 적용되었습니다.

src/main/java/eatda/service/story/StoryService.java (3)

14-14: Store 관련 의존성이 적절히 추가됨

Store 도메인과 StoreRepository 의존성이 올바르게 추가되었습니다.

Also applies to: 19-19, 40-40


99-101: storeId 조회 로직이 올바르게 구현됨

스토리의 storeKakaoId로 Store 엔티티를 조회하여 존재하면 id를, 없으면 null을 반환하는 로직이 적절히 구현되었습니다.


104-104: StoryResponse 생성자에 storeId가 올바르게 전달됨

새로 조회한 storeId가 StoryResponse의 첫 번째 파라미터로 올바르게 전달되었습니다.

src/test/java/eatda/document/story/StoryDocumentTest.java (3)

8-9: JsonFieldType import가 적절히 추가됨

응답 필드의 타입을 명시적으로 지정하기 위한 import가 올바르게 추가되었습니다.


168-176: 기존 필드들의 타입이 명시적으로 지정됨

기존 응답 필드들에 JsonFieldType이 적절히 추가되어 문서화가 더욱 명확해졌습니다.


182-183: 테스트 케이스가 nullable storeId를 올바르게 반영함

StoryResponse 생성자에 null 값을 첫 번째 인자로 전달하여 storeId의 nullable 특성을 적절히 테스트하고 있습니다.

src/test/java/eatda/service/story/StoryServiceTest.java (3)

5-5: 필요한 import가 적절히 추가됨

assertAll과 Store import가 올바르게 추가되었습니다.

Also applies to: 16-16


112-144: 스토어ID가 없는 경우의 테스트가 올바르게 수정됨

메서드명이 더 명확해지고, storeId가 null인지 검증하는 로직이 적절히 추가되었습니다. assertAll을 사용하여 모든 필드를 체계적으로 검증하고 있습니다.


146-179: 스토어ID가 있는 경우의 테스트가 적절히 추가됨

storeGenerator를 사용하여 Store 엔티티를 생성하고, 해당 Store와 연결된 Story가 올바른 storeId를 반환하는지 검증하는 테스트가 잘 구현되었습니다.

Copy link
Member

@lvalentine6 lvalentine6 left a comment

Choose a reason for hiding this comment

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

이번 PR도 고생하셨습니다! 🦖
코드 자동 정렬 한번 돌릴까요...?

void 스토리_상세_조회_성공() {
long storyId = 1L;
StoryResponse response = new StoryResponse(
StoryResponse response =new StoryResponse(
Copy link
Member

@lvalentine6 lvalentine6 Jul 31, 2025

Choose a reason for hiding this comment

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

=new StoryResponse( -> = new StoryResponse( 이라면...?

@sonarqubecloud
Copy link

@leegwichan leegwichan merged commit 0db5d62 into develop Jul 31, 2025
4 checks passed
@leegwichan leegwichan deleted the feat/story-add-storeId branch July 31, 2025 14:51
@github-actions
Copy link

🎉 This PR is included in version 1.4.0-develop.40 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Aug 1, 2025

🎉 This PR is included in version 1.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants