Skip to content

Conversation

@efdao
Copy link
Collaborator

@efdao efdao commented Mar 31, 2025

#️⃣ 연관된 이슈>

📝 작업 내용> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

  • 논의 확정 시 discussionStatus가 UPCOMMING으로 변경되는데 FINISHED가 아니면 400 던지도록 되어있었습니다.
  • 정상적으로 UPCOMMING인지 비교하도록 수정했습니다.

🙏 여기는 꼭 봐주세요! > 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

Summary by CodeRabbit

  • Bug Fixes
    • Revised the discussion restart process so that only discussions scheduled to begin (upcoming) can be restarted. Users will now see clearer, more accurate feedback when attempting to restart a discussion that doesn’t meet the new eligibility criteria.
    • Updated error messaging to better reflect the required discussion status, improving overall clarity and user experience.

@efdao efdao added the 🛠️ BE Backend label Mar 31, 2025
@efdao efdao added this to the 💪8차 스프린트 milestone Mar 31, 2025
@efdao efdao self-assigned this Mar 31, 2025
@efdao efdao requested a review from kwon204 as a code owner March 31, 2025 10:31
@coderabbitai
Copy link

coderabbitai bot commented Mar 31, 2025

Walkthrough

The changes update the discussion restart functionality. The restartDiscussion method in the DiscussionService now checks if the discussion is in the UPCOMING status instead of FINISHED. Accordingly, the error code has been updated from DISCUSSION_NOT_FINISHED to DISCUSSION_NOT_UPCOMING in both the service and ErrorCode enum. Test cases have been adjusted to verify that the correct status and error handling apply.

Changes

File(s) Change Summary
backend/.../DiscussionService.java Updated restartDiscussion logic: now checks for UPCOMING instead of FINISHED and throws ApiException with DISCUSSION_NOT_UPCOMING if condition fails.
backend/.../ErrorCode.java Modified the enum: replaced DISCUSSION_NOT_FINISHED with DISCUSSION_NOT_UPCOMING and updated the descriptive message accordingly.
backend/.../DiscussionServiceTest.java Revised tests: updated display names and assertions to expect discussion status UPCOMING and verify the new error code and status transitions to ONGOING.

Sequence Diagram(s)

sequenceDiagram
  participant C as Client
  participant DS as DiscussionService
  participant D as Discussion

  C->>DS: restartDiscussion(discussionId)
  DS->>D: Check current status
  alt Status is UPCOMING
      DS->>D: Update status to ONGOING
      DS->>C: Return success response
  else Status is not UPCOMING
      DS->>C: Throw ApiException (DISCUSSION_NOT_UPCOMING)
  end
Loading

Possibly related PRs

Suggested reviewers

  • kwon204

Poem

I’m hopping through the lines of code,
A rabbit with a cheerful mode.
UPCOMING now leads the dance,
With errors renamed at first glance.
Leaping over bugs, I delight,
In changes that make our code shine bright! 🐰✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5aa4921 and 9e180ce.

📒 Files selected for processing (3)
  • backend/src/main/java/endolphin/backend/domain/discussion/DiscussionService.java (1 hunks)
  • backend/src/main/java/endolphin/backend/global/error/exception/ErrorCode.java (1 hunks)
  • backend/src/test/java/endolphin/backend/domain/discussion/DiscussionServiceTest.java (5 hunks)
🔇 Additional comments (7)
backend/src/main/java/endolphin/backend/domain/discussion/DiscussionService.java (1)

312-313: Fixed status check logic for restarting discussions.

This change correctly implements the fix for issue #333 by checking if the discussion is in the UPCOMING status instead of the FINISHED status. This ensures that only discussions in the UPCOMING status can be restarted, preventing the 400 response bug when attempting to restart a discussion that has been confirmed.

backend/src/main/java/endolphin/backend/global/error/exception/ErrorCode.java (1)

21-21: Updated error code to match the new logic.

The error code has been updated from DISCUSSION_NOT_FINISHED to DISCUSSION_NOT_UPCOMING to align with the status check change in the DiscussionService. This maintains consistency between the service logic and error messaging.

backend/src/test/java/endolphin/backend/domain/discussion/DiscussionServiceTest.java (5)

687-687: Updated test display name to reflect new status requirement.

The test display name has been updated to correctly describe that a discussion must be in the UPCOMING status (not FINISHED) for restart to succeed.


697-697: Updated test setup to use UPCOMING status.

Changed the discussion status in the test to UPCOMING to correctly match the updated service logic.


714-714: Updated error test description to match new status check.

Test description has been updated to verify that an exception is thrown when the discussion is not in the UPCOMING status.


728-728: Updated expected error code in test.

The assertion now correctly checks for the DISCUSSION_NOT_UPCOMING error code instead of DISCUSSION_NOT_FINISHED.


743-743: Updated discussion status in host permission test.

Changed the discussion status in the host permission test to UPCOMING to maintain consistency with the updated service logic.

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link
Contributor

@kwon204 kwon204 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.

@efdao efdao merged commit 8e5d345 into dev Apr 3, 2025
7 checks passed
@efdao efdao deleted the bugfix/be/restart-discussion branch April 3, 2025 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ BE Backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants