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-109] Club 엔터티 formUrl 속성 제거 및 formId 속성 추가 #259

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Seooooo24
Copy link
Collaborator

@Seooooo24 Seooooo24 commented Feb 11, 2025

🚀 작업 내용

지원하기 폼지 연결을 띵동 자체 폼지로 강제하기 위하여
Club 엔터티 formUrl 속성 제거 및 formId 속성 추가하였습니다.

🤔 고민했던 내용

formUrl을 완전히 삭제해도 되는지 궁금합니다.

💬 리뷰 중점사항

Summary by CodeRabbit

  • Refactor
    • 클럽 정보 내 모집 양식 표현이 기존 URL 방식에서 숫자형 ID 방식으로 전환되었습니다. 이로 인해 클럽 정보 조회 및 업데이트 시 보다 명확한 정보 제공이 이루어집니다.
  • Chore
    • 데이터베이스 스키마가 업데이트되어 모집 양식 URL에 해당하는 불필요한 컬럼이 제거되었습니다.

Copy link

coderabbitai bot commented Feb 11, 2025

Walkthrough

전체 변경 사항은 여러 계층의 데이터 전송 객체(DTO), 명령(Command), 쿼리(Query) 및 엔티티에서 URL 형태의 formUrl 필드를 제거하고, 응답 및 조회 DTO에서는 숫자형 formId 필드를 도입하는 것입니다. 각 변환 메서드와 생성자, 업데이트 로직이 해당 변경 사항에 맞게 수정되었으며, 데이터베이스에서는 클럽 테이블에서 form_url 컬럼이 삭제되었습니다.

Changes

파일 변경 내역
src/.../club/controller/dto/request/UpdateClubInfoRequest.java
src/.../club/service/dto/command/UpdateClubInfoCommand.java
formUrl 필드 제거 및 관련 메서드(예, toCommand, toEntity)에서 해당 파라미터 제거
src/.../club/controller/dto/response/MyClubInfoResponse.java
src/.../club/controller/dto/response/UserClubResponse.java
기존의 formUrl 필드 삭제 후, Long formId 필드 추가; from 메서드에서 query.formUrl() 호출을 query.formId()로 변경
src/.../club/entity/Club.java formUrl 프로퍼티 제거 및 생성자, 업데이트 메서드에서 관련 처리 삭제
src/.../club/service/dto/query/MyClubInfoQuery.java
src/.../club/service/dto/query/UserClubQuery.java
String formUrl 필드를 삭제하고 Long formId 필드를 추가; 팩토리 메서드 내에서 클럽 엔티티로부터 formUrl 호출 대신 formId 호출로 수정
src/.../db/migration/V39__alter_table_club_drop_colmn.sql SQL 명령으로 클럽 테이블에서 form_url 컬럼 삭제

Suggested labels

D-0

Suggested reviewers

  • wonjunYou
  • 5uhwann
  • KoSeonJe
✨ 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.

@Seooooo24 Seooooo24 added D-3 🎯리팩토링 리팩토링 및 고도화 이슈 labels Feb 11, 2025
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: 2

🧹 Nitpick comments (1)
src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/command/UpdateClubInfoCommand.java (1)

23-23: formId에 대한 유효성 검증이 필요합니다.

formId가 필수 필드라면, null 체크나 유효성 검증 로직을 추가하는 것이 좋습니다.

다음과 같이 검증 로직을 추가하는 것을 고려해보세요:

 public Club toEntity() {
+    if (formId == null) {
+        throw new IllegalArgumentException("폼 ID는 필수 값입니다.");
+    }
     return Club.builder()

Also applies to: 42-42

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between accfe45 and 708811f.

📒 Files selected for processing (8)
  • src/main/java/ddingdong/ddingdongBE/domain/club/controller/dto/request/UpdateClubInfoRequest.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/controller/dto/response/MyClubInfoResponse.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/controller/dto/response/UserClubResponse.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/entity/Club.java (4 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/command/UpdateClubInfoCommand.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/query/MyClubInfoQuery.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/query/UserClubQuery.java (2 hunks)
  • src/main/resources/db/migration/V39__alter_table_club_drop_add_colmn.sql (1 hunks)
🔇 Additional comments (5)
src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/query/UserClubQuery.java (1)

20-20: 변경사항이 적절합니다!

formUrl에서 formId로의 변경이 일관되게 적용되었으며, 이는 딩동 플랫폼의 자체 폼 사용을 강제하는 PR의 목적에 부합합니다.

Also applies to: 42-42

src/main/java/ddingdong/ddingdongBE/domain/club/service/dto/query/MyClubInfoQuery.java (1)

20-20: 변경사항이 적절합니다!

UserClubQuery와 동일한 패턴으로 formId 필드가 일관되게 구현되었습니다.

Also applies to: 43-43

src/main/resources/db/migration/V39__alter_table_club_drop_add_colmn.sql (1)

1-7: 데이터 마이그레이션 계획 확인 필요

기존 form_url 데이터를 form_id로 변환하는 마이그레이션 계획이 필요합니다.

다음 사항들을 확인해 주세요:

  1. 기존 form_url 데이터를 form_id로 매핑하는 방법
  2. 매핑할 수 없는 데이터 처리 방안
  3. 데이터 손실 가능성 검토
src/main/java/ddingdong/ddingdongBE/domain/club/controller/dto/response/UserClubResponse.java (1)

40-41: 변경사항이 적절합니다!

formId 필드의 스키마 문서화가 명확하고, 엔티티 변경사항과 일관성이 있습니다.

src/main/java/ddingdong/ddingdongBE/domain/club/controller/dto/response/MyClubInfoResponse.java (1)

40-41: 변경사항이 적절합니다!

formId 필드의 스키마 문서화가 명확하고, UserClubResponse와 일관성이 있습니다.

Comment on lines 45 to 46
@Schema(description = "모집 폼 아이디", example = "6")
Long formId,
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

formId 필드에 @NotNull 제약조건이 필요합니다.

모집 폼이 필수라면, 다른 필수 필드들처럼 @NotNull 어노테이션과 적절한 메시지를 추가해야 합니다.

다음과 같이 수정하는 것을 추천드립니다:

 @Schema(description = "모집 폼 아이디", example = "6")
+@NotNull(message = "모집 폼 아이디는 필수로 입력해야 합니다.")
 Long formId,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Schema(description = "모집 폼 아이디", example = "6")
Long formId,
@Schema(description = "모집 폼 아이디", example = "6")
@NotNull(message = "모집 폼 아이디는 필수로 입력해야 합니다.")
Long formId,

@@ -70,7 +70,7 @@ public class Club extends BaseEntity {

private String ideal;

private String formUrl;
private Long formId;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

formId 유효성 검증 추가 필요

formId가 유효한 Form을 참조하는지 확인하는 로직이 필요합니다.

다음과 같은 검증 메서드 추가를 제안합니다:

private void validateFormId(Long formId) {
    if (formId == null) {
        throw new IllegalArgumentException("Form ID는 필수 값입니다.");
    }
    // TODO: Form 존재 여부 확인 로직 추가
}

클라이언트에서 직접 formId 업데이트를 요청할 일이 없을 것 같아 삭제했습니다.
@github-actions github-actions bot added D-2 and removed D-3 labels Feb 12, 2025
@Seooooo24 Seooooo24 marked this pull request as draft February 12, 2025 13:40
@Seooooo24 Seooooo24 marked this pull request as ready for review February 13, 2025 04:37
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/club/entity/Club.java (1)

123-126: 메서드 이름과 실제 동작이 일치하지 않음

addClubMember 메서드 내부에서 호출하는 setClubFormConvenience는 메서드 이름과 일치하지 않는 동작을 수행하는 것으로 보입니다.

메서드 이름을 실제 동작과 일치하도록 변경하거나, 메서드의 목적을 명확히 하는 주석을 추가해 주세요.

-    clubMember.setClubFormConvenience(this);
+    clubMember.setClub(this);  // 클럽 멤버와 클럽 간의 양방향 관계 설정
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c0ca35b and 300e9c5.

📒 Files selected for processing (2)
  • src/main/java/ddingdong/ddingdongBE/domain/club/entity/Club.java (1 hunks)
  • src/main/resources/db/migration/V39__alter_table_club_drop_colmn.sql (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/resources/db/migration/V39__alter_table_club_drop_colmn.sql
🔇 Additional comments (1)
src/main/java/ddingdong/ddingdongBE/domain/club/entity/Club.java (1)

34-78: ⚠️ Potential issue

formId 필드 추가 필요

PR 목적에 따라 formUrl을 제거하고 formId를 추가하는 것이 필요하지만, formId 필드가 구현되지 않았습니다.

다음과 같이 formId 필드를 추가해 주세요:

    @Column(name = "deleted_at", columnDefinition = "TIMESTAMP")
    private LocalDateTime deletedAt;

+   private Long formId;

이전 리뷰에서 제안된 대로 formId 유효성 검증도 함께 추가해 주세요.

@github-actions github-actions bot added D-1 and removed D-2 labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-1 🎯리팩토링 리팩토링 및 고도화 이슈
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant