Skip to content

Conversation

@lvalentine6
Copy link
Member

@lvalentine6 lvalentine6 commented Jul 21, 2025

✨ 개요

  • 기획에서 스토리 등록 후 스토리 상세페이지로 리다이렉트 되는것으로 변경되어 응답 구조를 변경했습니다.
  • 이전 PR과 충돌 날수 있으니 이번 PR이 먼저 merge 되는게 낫지 않을까 싶긴 합니다.

🧾 관련 이슈

#92

🔍 참고 사항 (선택)

Summary by CodeRabbit

  • 신규 기능

    • 스토리 등록 시 응답 본문에 storyId가 포함되어 반환됩니다.
  • 버그 수정

    • 스토리 등록 관련 테스트가 실제로 반환된 storyId를 검증하도록 개선되었습니다.
  • 테스트

    • 스토리 등록 API의 응답 본문에 storyId가 포함되는지 확인하는 테스트가 추가 및 강화되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Walkthrough

Story 등록 API의 응답 타입이 변경되었습니다. 이제 Story 등록 시, 생성된 storyId를 포함한 StoryRegisterResponse 객체가 201 응답 본문으로 반환됩니다. 이에 따라 서비스와 컨트롤러, 그리고 관련 테스트 코드들이 모두 이 변경에 맞게 수정되었습니다.

Changes

파일/경로 요약 변경 내용 요약
src/main/java/eatda/controller/story/StoryController.java registerStory 메서드의 반환 타입을 StoryRegisterResponse로 변경하고, 응답 본문에 storyId 포함
src/main/java/eatda/controller/story/StoryRegisterResponse.java storyId를 담는 StoryRegisterResponse record 신규 추가
src/main/java/eatda/service/story/StoryService.java registerStory 메서드가 StoryRegisterResponse를 반환하도록 변경
src/test/java/eatda/controller/story/StoryControllerTest.java,
src/test/java/eatda/document/story/StoryDocumentTest.java
storyService.registerStory의 반환값을 StoryRegisterResponse로 변경, 응답 본문 검증 추가
src/test/java/eatda/service/story/StoryServiceTest.java registerStory의 반환값을 활용하여 저장된 storyId 검증, 예외 미발생 검증에서 저장 검증으로 변경

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as StoryController
    participant Service as StoryService
    participant Repo as StoryRepository

    Client->>Controller: POST /stories (StoryRegisterRequest, image)
    Controller->>Service: registerStory(request, image, memberId)
    Service->>Repo: save(Story)
    Repo-->>Service: saved Story (with id)
    Service-->>Controller: StoryRegisterResponse(storyId)
    Controller-->>Client: 201 Created + { storyId }
Loading

Estimated code review effort

2 (~15분)

Possibly related PRs

Suggested labels

feat, released on @beta

Suggested reviewers

  • leegwichan

Poem

🐰
새로운 Story가 탄생했지,
이제는 storyId도 함께 가지!
응답 본문에 담긴 기쁨,
테스트도 꼼꼼히 챙겼으니,
토끼는 오늘도 깡총깡총,
코드 리뷰하러 갑니다, 총총!


📜 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 65390cc and 44409de.

📒 Files selected for processing (6)
  • src/main/java/eatda/controller/story/StoryController.java (1 hunks)
  • src/main/java/eatda/controller/story/StoryRegisterResponse.java (1 hunks)
  • src/main/java/eatda/service/story/StoryService.java (3 hunks)
  • src/test/java/eatda/controller/story/StoryControllerTest.java (3 hunks)
  • src/test/java/eatda/document/story/StoryDocumentTest.java (3 hunks)
  • src/test/java/eatda/service/story/StoryServiceTest.java (1 hunks)
🔇 Additional comments (13)
src/main/java/eatda/controller/story/StoryRegisterResponse.java (1)

3-6: 깔끔한 DTO 구현입니다.

Java record를 사용한 간단하고 명확한 응답 DTO 구현이 적절합니다. 불변성과 간결성을 모두 확보했습니다.

src/test/java/eatda/controller/story/StoryControllerTest.java (3)

24-26: 테스트 설정이 새로운 API 계약에 맞게 올바르게 수정되었습니다.

doNothing()에서 StoryRegisterResponse 반환으로 변경한 것이 적절합니다.


44-46: 구체적인 storyId 값으로 테스트하는 것이 좋습니다.

테스트에서 명시적인 값(123L)을 사용하여 응답 검증을 더 정확하게 수행하고 있습니다.


56-58: 응답 본문 검증이 추가되어 테스트 커버리지가 향상되었습니다.

상태 코드뿐만 아니라 실제 응답 본문의 storyId 필드까지 검증하여 더 완전한 테스트가 되었습니다.

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

7-7: 필요한 import가 올바르게 추가되었습니다.

새로운 응답 타입을 위한 import가 적절히 추가되었습니다.


38-38: 메서드 시그니처가 새로운 요구사항에 맞게 수정되었습니다.

void에서 StoryRegisterResponse 반환 타입으로의 변경이 적절합니다.


57-57: 생성된 리소스의 ID를 반환하는 것이 좋은 설계입니다.

스토리 저장 후 생성된 ID를 응답으로 반환하여 클라이언트가 후속 작업(상세 페이지 이동 등)을 수행할 수 있도록 합니다.

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

11-11: 문서화 테스트에 필요한 import가 추가되었습니다.

새로운 응답 타입을 위한 import가 적절합니다.


42-45: API 문서에 응답 필드가 올바르게 추가되었습니다.

storyId 필드에 대한 설명이 포함되어 API 문서가 완전해졌습니다.


53-55: 문서화 테스트의 모킹이 올바르게 수정되었습니다.

실제 서비스 구현과 일치하는 응답을 반환하도록 모킹이 적절히 변경되었습니다.


79-81: 응답 검증이 문서화된 API 계약과 일치합니다.

상태 코드와 응답 본문 모두 검증하여 문서화가 정확함을 보장합니다.

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

50-52: 테스트가 더 의미있고 철저해졌습니다.

단순히 예외가 발생하지 않는지만 확인하던 것에서, 실제로 스토리가 저장되었는지 반환된 ID로 검증하는 방식으로 개선되었습니다. 이는 더 강력한 테스트 커버리지를 제공합니다.

src/main/java/eatda/controller/story/StoryController.java (1)

25-31: 스토리 등록 API 응답 개선 검증 완료 및 승인

  • src/main/java/eatda/controller/story/StoryRegisterResponse.javarecord StoryRegisterResponse가 올바르게 정의되어 있습니다.
  • src/main/java/eatda/service/story/StoryService.javapublic StoryRegisterResponse registerStory(StoryRegisterRequest, MultipartFile, Long) 시그니처가 컨트롤러 호출과 일치합니다.
  • HTTP 201 Created 상태와 ResponseEntity<StoryRegisterResponse> 반환 방식 모두 RESTful API 설계 원칙에 부합합니다.

이상으로 모든 변경사항이 예상대로 구현된 것을 확인했습니다.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@sonarqubecloud
Copy link

Copy link
Member

@leegwichan leegwichan left a comment

Choose a reason for hiding this comment

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

/noti 스토리 등록 시, 해당 ID를 주시는 것 확인했습니다!
승로님 말대로 이 PR이 먼저 오늘 회의 전후로 머지하면 좋겠네요! 고생하셨습니다!

@lvalentine6 lvalentine6 merged commit 723fde1 into develop Jul 22, 2025
7 checks passed
@lvalentine6 lvalentine6 deleted the fix/PRODUCT-193 branch July 22, 2025 19:38
@github-actions
Copy link

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

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 1.5.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