Skip to content

[hotfix] 기록 작성 유효성 검증 수정#168

Merged
buzz0331 merged 1 commit intodevelopfrom
hotfix/#167-validate-create-record
Aug 7, 2025
Merged

[hotfix] 기록 작성 유효성 검증 수정#168
buzz0331 merged 1 commit intodevelopfrom
hotfix/#167-validate-create-record

Conversation

@buzz0331
Copy link
Contributor

@buzz0331 buzz0331 commented Aug 7, 2025

#️⃣ 연관된 이슈

closes #167

📝 작업 내용

@Nico1eKim 요청에 따라 기록 생성 유효성 검증에서 isOverview = true로 넘어올때만 총평 가능 여부를 확인하도록 수정했습니다.

📸 스크린샷

💬 리뷰 요구사항

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

📌 PR 진행 시 이러한 점들을 참고해 주세요

* P1 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
* P2 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
* P3 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

Summary by CodeRabbit

  • 버그 수정
    • 오버뷰 작성 권한이 없는 참가자에 대한 검증 로직이 개선되어, 실제로 오버뷰 작성 시에만 예외가 발생하도록 변경되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 7, 2025

Walkthrough

RecordCreateService 클래스의 validateRoomParticipant 메서드가 isOverview 불리언 파라미터를 추가로 받도록 시그니처가 변경되었습니다. 내부 검증 로직이 isOverview가 true인 경우에만 예외를 발생시키도록 수정되었고, createRecord 메서드에서 해당 값을 전달하도록 호출부가 변경되었습니다.

Changes

Cohort / File(s) Change Summary
총평 유효성 검증 로직 수정
src/main/java/konkuk/thip/record/application/service/RecordCreateService.java
validateRoomParticipant 메서드가 isOverview 파라미터를 받도록 변경, 내부 검증 조건을 isOverview 값에 따라 예외 발생 여부를 결정하도록 수정. createRecord에서 호출 시 command.isOverview() 값 전달하도록 수정.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RecordCreateService
    participant RoomParticipant

    Client->>RecordCreateService: createRecord(command)
    RecordCreateService->>RoomParticipant: validateRoomParticipant(roomParticipant, command.isOverview())
    alt isOverview == true and cannot write overview
        RecordCreateService->>Client: throw Exception
    else
        RecordCreateService->>Client: return RecordCreateResult
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
기록 생성 시 총평 유효성 검증 로직 수정 (#167)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)

Poem

토끼가 총평을 살펴보네,
불필요한 예외는 이제 그만!
오버뷰일 때만 꼼꼼히 체크,
코드가 더 똑똑해졌지.
깡총깡총 리뷰를 마치며,
오늘도 평화로운 개발의 들판에서! 🐇✨

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 UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39b859c and e364580.

📒 Files selected for processing (1)
  • src/main/java/konkuk/thip/record/application/service/RecordCreateService.java (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서는 "사용자가 방에 속하는지 검증" 로직을 RoomParticipantPolicy 도메인 서비스로 캡슐화하여 재사용성을 높이고 비즈니스 로직의 중복을 방지하는 방식을 선호한다.
📚 Learning: 2025-07-26T06:09:00.850Z
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서 Record와 Vote는 Room에 속하지만 Feed는 Room에 속하지 않는 구조이며, 댓글 작성 시 Record/Vote에 대해서만 사용자가 해당 Room의 참가자인지 검증이 필요하다.

Applied to files:

  • src/main/java/konkuk/thip/record/application/service/RecordCreateService.java
📚 Learning: 2025-07-26T06:09:00.850Z
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#101
File: src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:36-39
Timestamp: 2025-07-26T06:09:00.850Z
Learning: THIP 프로젝트에서는 "사용자가 방에 속하는지 검증" 로직을 RoomParticipantPolicy 도메인 서비스로 캡슐화하여 재사용성을 높이고 비즈니스 로직의 중복을 방지하는 방식을 선호한다.

Applied to files:

  • src/main/java/konkuk/thip/record/application/service/RecordCreateService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
src/main/java/konkuk/thip/record/application/service/RecordCreateService.java (2)

57-57: LGTM! 메서드 호출부가 올바르게 업데이트되었습니다.

validateRoomParticipant 메서드에 command.isOverview() 파라미터를 전달하도록 수정하여 총평 검증 로직이 적절한 컨텍스트에서만 실행되도록 개선되었습니다.


80-82: 우수한 수정! 컨텍스트 기반 유효성 검증으로 개선되었습니다.

이제 총평 권한 검증이 실제로 총평을 작성할 때만 수행됩니다. 이전에는 일반 기록을 작성할 때도 총평 권한을 확인하여 불필요한 검증이 발생했지만, isOverview 플래그를 추가하여 적절한 컨텍스트에서만 검증이 실행되도록 개선되었습니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/#167-validate-create-record

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

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

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.

@buzz0331 buzz0331 merged commit 3145462 into develop Aug 7, 2025
2 checks passed
@buzz0331 buzz0331 deleted the hotfix/#167-validate-create-record branch August 7, 2025 16:38
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.

[THIP2025-223] [hotfix] 기록 생성시 총평 유효성 검증 수정

2 participants