Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DDING-000] 폼지 수정내 기간 검증로직 오류 수정 #267

Merged
merged 1 commit into from
Feb 15, 2025

Conversation

KoSeonJe
Copy link
Collaborator

@KoSeonJe KoSeonJe commented Feb 14, 2025

🚀 작업 내용

  • 이전 폼지 수정시 기존 폼지와 중복되는 날짜는 수정하지 못하게 검증하는 로직 구현
  • 위 로직에서 자기 자신을 포함하여 검증하는 오류가 발생하여 자기자신을 제외시키도록 수정

🤔 고민했던 내용

💬 리뷰 중점사항

Summary by CodeRabbit

  • 새로운 기능
    • 폼 고유 식별 기능이 추가되어, 사용자가 폼의 일관성을 보다 쉽게 확인할 수 있습니다.
  • 리팩터링
    • 폼 업데이트 시 중복 날짜 검증 로직이 개선되어, 현재 폼은 검증 과정에서 올바르게 제외되도록 조정되었습니다.
    • 업데이트 관련 내부 처리 프로세스가 단순화되어, 전체 폼 관리의 안정성이 향상되었습니다.

Copy link

coderabbitai bot commented Feb 14, 2025

Walkthrough

이번 변경사항은 Form 클래스에 새 public 메서드 isEqualsById를 추가하여 해당 인스턴스의 id와 인자로 전달된 formId를 비교할 수 있게 합니다. 또한, FacadeCentralFormServiceImpl 클래스의 updateForm 메서드에서 매개변수명을 단순화하고, 중복 날짜 검증 로직을 개선하기 위해 내부적으로 validateDuplicationDateExcludingSelf 메서드를 추가하며, 기존의 validateDuplicationDate 메서드의 가시성을 private으로 변경하였습니다.

Changes

파일 경로 변경 요약
src/main/java/ddingdong/ddingdongBE/.../Form.java Form 클래스에 isEqualsById 메서드 추가
src/main/java/ddingdong/ddingdongBE/.../FacadeCentralFormServiceImpl.java updateForm 메서드의 매개변수명 변경 및 중복 날짜 검증 로직 개선
- 기존 validateDuplicationDate의 가시성을 private으로 변경
- 새로운 validateDuplicationDateExcludingSelf 메서드 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client as 호출자
    participant Service as FacadeCentralFormServiceImpl
    participant FormRepo as 폼 저장소

    Client->>Service: updateForm(command)
    Service->>Service: validateDuplicationDateExcludingSelf(club, startDate, endDate, formId)
    alt 중복 없음
        Service->>FormRepo: 폼 조회 및 업데이트
    else 중복 있음
        Service->>Client: 중복 오류 응답
    end
Loading
sequenceDiagram
    participant Caller as 호출자
    participant Form as Form 객체

    Caller->>Form: isEqualsById(formId)
    Form-->>Caller: boolean 결과
Loading

Suggested labels

🛠️버그, 🎯리팩토링, D-0

Suggested reviewers

  • wonjunYou
  • 5uhwann
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @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 (1)
src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeCentralFormServiceImpl.java (1)

189-203: 중복 날짜 검증 로직이 개선되었습니다!

현재 수정 중인 폼을 제외하고 날짜 중복을 검사하는 새로운 메서드가 추가되어 검증 로직이 정확해졌습니다. 스트림 API를 사용하여 깔끔하게 구현되었습니다.

하나 제안드리고 싶은 점은, 메서드 이름을 더 명확하게 할 수 있을 것 같습니다:

-    private void validateDuplicationDateExcludingSelf(
+    private void validateDateOverlapExcludingSelf(

또는

-    private void validateDuplicationDateExcludingSelf(
+    private void validateNoDateOverlapExceptSelf(
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 27ba021 and 44dbd32.

📒 Files selected for processing (2)
  • src/main/java/ddingdong/ddingdongBE/domain/form/entity/Form.java (1 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeCentralFormServiceImpl.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and analyze
🔇 Additional comments (3)
src/main/java/ddingdong/ddingdongBE/domain/form/entity/Form.java (1)

79-81: 구현이 명확하고 목적에 부합합니다!

ID 비교를 위한 간단하면서도 명확한 메서드입니다. equals()를 사용하여 null 안전성도 보장되어 있습니다.

src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeCentralFormServiceImpl.java (2)

68-74: 매개변수명이 더 간결해졌습니다!

updateFormCommand에서 command로 변경하여 코드가 더 간결해졌습니다.


176-187: 메서드 가시성 변경이 적절합니다!

validateDuplicationDate 메서드를 private으로 변경한 것은 내부 구현 세부사항을 적절히 캡슐화한 좋은 변경입니다.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Collaborator

@Seooooo24 Seooooo24 left a comment

Choose a reason for hiding this comment

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

확인했습니다!

@github-actions github-actions bot added the D-3 label Feb 14, 2025
@KoSeonJe KoSeonJe merged commit 6d00cc3 into develop Feb 15, 2025
3 of 4 checks passed
@KoSeonJe KoSeonJe deleted the fix/DDING-000 branch February 15, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants