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] 지원하기 요청 dto 필드 추가 및 폼지 상세 조회 응답에 지원자 수 필드 추가 #268

Merged
merged 3 commits into from
Feb 15, 2025

Conversation

Seooooo24
Copy link
Collaborator

@Seooooo24 Seooooo24 commented Feb 14, 2025

🚀 작업 내용

프론트 요청사항에 따라
지원하기 요청 dto에 이메일, 전화번호를 추가하였습니다.
(User)폼지 상세 조회 응답에서 지원자 수를 내려주도록 변경하였습니다.

🤔 고민했던 내용

💬 리뷰 중점사항

Summary by CodeRabbit

  • 신규 기능

    • 사용자 폼 응답에 신청자 수 정보가 추가되어, 양식의 현황을 보다 명확하게 확인할 수 있습니다.
    • 폼 신청 시 이메일과 전화번호 입력란이 도입되어, 추가 연락처 정보를 제공할 수 있습니다.
  • 버그 수정

    • 개별 신청자 수 조회 기능이 제거되어, 데이터 제공이 단순화되고 일관성이 강화되었습니다.

Copy link

coderabbitai bot commented Feb 14, 2025

Caution

Review failed

The pull request is closed.

"""

Walkthrough

이 PR은 UserForm 관련 응답 및 쿼리 객체에 새로운 applicationCount 필드를 추가하여 폼 지원자 수를 반영하도록 업데이트합니다. 또한, FacadeUserFormServiceImplFormStatisticService 의존성을 도입해 지원자 수를 가져오고, 관련 API, 컨트롤러, 서비스 인터페이스에서 기존 지원자 수 관련 메소드와 DTO들을 제거하였습니다. 더불어, 폼 지원 신청 생성 객체에 emailphoneNumber 필드를 추가하여 추가 연락처 정보를 함께 처리하도록 변경되었습니다.

Changes

파일 경로 변경 사항 요약
.../domain/form/controller/dto/response/UserFormResponse.java
.../domain/form/service/dto/query/UserFormQuery.java
applicationCount 필드 추가 및 관련 생성자/from 메소드 수정 (폼 지원자 수 반영)
.../domain/form/service/FacadeUserFormServiceImpl.java FormStatisticService 의존성 추가 및 getUserForm 메소드 수정하여 지원자 수 포함 처리
.../domain/formapplication/api/UserFormApplicationApi.java
.../domain/formapplication/controller/UserFormApplicationController.java
.../domain/formapplication/service/FacadeUserFormApplicationService.java
.../domain/formapplication/service/FacadeUserFormApplicationServiceImpl.java
.../domain/formapplication/controller/dto/response/FormApplicationCountResponse.java
.../domain/formapplication/service/dto/query/FormApplicationCountQuery.java
폼 지원자 수 관련 메소드, DTO, 의존성 및 파일 삭제 (기존 지원자 수 기능 제거)
.../domain/formapplication/controller/dto/request/CreateFormApplicationRequest.java
.../domain/formapplication/service/dto/command/CreateFormApplicationCommand.java
emailphoneNumber 필드 추가와 이에 따른 메소드 수정 (추가 연락처 정보 처리)

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant FacadeUserFormService
    participant FormStatisticService
    participant DataStore

    Client->>Controller: getUserForm(formId, section) 호출
    Controller->>FacadeUserFormService: getUserForm(formId, section) 전달
    FacadeUserFormService->>FormStatisticService: getTotalApplicationCountByForm(form) 호출
    FormStatisticService-->>FacadeUserFormService: applicationCount 반환
    FacadeUserFormService->>DataStore: form 및 필드 조회 요청
    DataStore-->>FacadeUserFormService: form, 필드 반환
    FacadeUserFormService->>Controller: UserFormQuery (applicationCount 포함) 반환
    Controller->>Client: UserFormResponse 전송
Loading

Possibly related PRs

Suggested labels

✨기능

Suggested reviewers

  • wonjunYou
  • 5uhwann
  • KoSeonJe
    """

📜 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 c12d55c and 884f1a3.

📒 Files selected for processing (1)
  • src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeUserFormServiceImpl.java (2 hunks)
✨ 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 the D-1 label Feb 14, 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/form/controller/dto/response/UserFormResponse.java (1)

61-61: 음수 값 검증 추가를 고려해보세요.

지원자 수는 음수가 될 수 없으므로, UserFormQuery에서 applicationCount가 음수인 경우에 대한 검증 로직 추가를 고려해보시면 좋을 것 같습니다.

예시 코드:

private static void validateApplicationCount(int count) {
    if (count < 0) {
        throw new IllegalArgumentException("지원자 수는 음수가 될 수 없습니다.");
    }
}
📜 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 c12d55c.

📒 Files selected for processing (11)
  • src/main/java/ddingdong/ddingdongBE/domain/form/controller/dto/response/UserFormResponse.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/form/service/FacadeUserFormServiceImpl.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/form/service/dto/query/UserFormQuery.java (1 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/api/UserFormApplicationApi.java (0 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/UserFormApplicationController.java (0 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/dto/request/CreateFormApplicationRequest.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/dto/response/FormApplicationCountResponse.java (0 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationService.java (0 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationServiceImpl.java (0 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/dto/command/CreateFormApplicationCommand.java (2 hunks)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/dto/query/FormApplicationCountQuery.java (0 hunks)
💤 Files with no reviewable changes (6)
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationService.java
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/dto/query/FormApplicationCountQuery.java
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationServiceImpl.java
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/dto/response/FormApplicationCountResponse.java
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/api/UserFormApplicationApi.java
  • src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/UserFormApplicationController.java
⏰ 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/service/FacadeUserFormServiceImpl.java (1)

19-19: 구현이 깔끔하고 적절합니다!

FormStatisticService 의존성 주입과 applicationCount 통합이 잘 되어있습니다. 단일 책임 원칙을 잘 지키면서 기능을 확장했습니다.

Also applies to: 31-32

src/main/java/ddingdong/ddingdongBE/domain/form/service/dto/query/UserFormQuery.java (1)

10-28: 잘 구현되었습니다!

UserFormQuery 레코드에 applicationCount 필드 추가와 빌더 패턴 활용이 깔끔합니다. 불변성을 잘 유지하면서 기능이 확장되었습니다.

src/main/java/ddingdong/ddingdongBE/domain/form/controller/dto/response/UserFormResponse.java (1)

17-18: 필드 추가가 잘 구현되었습니다!

Schema 어노테이션을 통해 API 문서화가 잘 되어있고, 예시 값도 적절하게 제공되어 있습니다.

Comment on lines +17 to +18
String email,
String phoneNumber,
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

이메일 형식 검증 추가를 고려해보세요.

이메일 필드가 추가되었지만, 이메일 형식에 대한 검증이 없습니다. 잘못된 이메일 형식이 입력될 수 있습니다.

다음과 같이 이메일 형식 검증을 추가하는 것을 추천드립니다:

 public record CreateFormApplicationCommand(
         Long formId,
         String name,
         String studentNumber,
         String department,
+        @Email(message = "올바른 이메일 형식이 아닙니다.")
         String email,
         String phoneNumber,
         FormApplicationStatus status,
         List<CreateFormAnswerCommand> formAnswerCommands
 )

Also applies to: 43-44

Comment on lines +26 to +32
@NotNull(message = "지원자 이메일은 필수 입력 사항입니다.")
@Schema(description = "이메일", example = "[email protected]")
String email,

@NotNull(message = "지원자 전화번호는 필수 입력 사항입니다.")
@Schema(description = "전화번호", example = "010-0000-0000")
String phoneNumber,
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

전화번호 형식 검증 추가를 고려해보세요.

전화번호 필드에 @NotNull 검증은 있지만, 전화번호 형식에 대한 검증이 없습니다. 잘못된 형식의 전화번호가 입력될 수 있습니다.

다음과 같이 정규식을 사용한 전화번호 형식 검증을 추가하는 것을 추천드립니다:

+        @Pattern(
+            regexp = "^\\d{3}-\\d{3,4}-\\d{4}$",
+            message = "전화번호 형식이 올바르지 않습니다. (예: 010-0000-0000)"
+        )
         @NotNull(message = "지원자 전화번호는 필수 입력 사항입니다.")
         @Schema(description = "전화번호", example = "010-0000-0000")
         String phoneNumber,
📝 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
@NotNull(message = "지원자 이메일은 필수 입력 사항입니다.")
@Schema(description = "이메일", example = "[email protected]")
String email,
@NotNull(message = "지원자 전화번호는 필수 입력 사항입니다.")
@Schema(description = "전화번호", example = "010-0000-0000")
String phoneNumber,
@NotNull(message = "지원자 이메일은 필수 입력 사항입니다.")
@Schema(description = "이메일", example = "[email protected]")
String email,
+ @Pattern(
+ regexp = "^\\d{3}-\\d{3,4}-\\d{4}$",
+ message = "전화번호 형식이 올바르지 않습니다. (예: 010-0000-0000)"
+ )
@NotNull(message = "지원자 전화번호는 필수 입력 사항입니다.")
@Schema(description = "전화번호", example = "010-0000-0000")
String phoneNumber,

Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@github-actions github-actions bot added D-0 and removed D-1 labels Feb 14, 2025
Copy link
Collaborator

@KoSeonJe KoSeonJe left a comment

Choose a reason for hiding this comment

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

확인하였습니다. 코멘트 1개 남긴거만 고치고 머지하면 될 것 같아요!

Comment on lines 30 to 32
List<FormField> formFieldList = formFieldService.getAllByFormAndSection(form, section);
return UserFormQuery.from(form, formFieldList);
int applicationCount = formStatisticService.getTotalApplicationCountByForm(form);
return UserFormQuery.from(form, applicationCount, formFieldList);
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3) formFieldList -> formFields 로 컨벤션 맞추는 게 좋을 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

수정했습니다!

@Seooooo24 Seooooo24 merged commit 2293445 into develop Feb 15, 2025
1 check failed
@Seooooo24 Seooooo24 deleted the refactor/DDING-000 branch February 15, 2025 08:05
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