-
Notifications
You must be signed in to change notification settings - Fork 1
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-113] 지원자 수 조회 API 구현 #263
Conversation
Caution Review failedThe pull request is closed. Walkthrough이번 PR은 폼 신청 개수를 조회하는 새로운 기능을 추가합니다. API, 컨트롤러, 서비스 및 DTO 레이어에 관련 메서드와 레코드를 도입하여 특정 폼 ID에 대한 신청 개수를 반환할 수 있도록 변경되었습니다. API 인터페이스와 컨트롤러에서 해당 메서드를 추가하고, 서비스 계층에서는 통계 서비스를 활용하여 데이터 조회 및 응답 객체 생성을 구현하였습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant U as 사용자
participant A as API
participant C as Controller
participant S as Service
participant F as FormStatisticService
U->>A: getNumberOfFormApplication(formId)
A->>C: getNumberOfFormApplication(formId, principalDetails)
C->>S: getFormApplicationCount(formId)
S->>F: getTotalApplicationCountByForm(formId)
F-->>S: 폼 신청 개수 반환
S-->>C: FormApplicationCountQuery 전달
C-->>A: FormApplicationCountResponse 생성 (from Query)
A-->>U: 응답 전송 (폼 신청 개수)
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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/formapplication/service/FacadeUserFormApplicationServiceImpl.java (1)
45-49
: 서비스 구현이 깔끔하며, 트랜잭션 관리가 적절합니다.다만, 폼이 존재하지 않을 경우의 예외 처리를 명시적으로 처리하면 좋을 것 같습니다.
다음과 같이 예외 처리를 추가하는 것을 제안드립니다:
@Override public FormApplicationCountQuery getFormApplicationCount(Long formId) { Form form = formService.getById(formId); + if (!form.isActive()) { + throw new BusinessException(ErrorCode.FORM_NOT_ACTIVE); + } return FormApplicationCountQuery.of(formStatisticService.getTotalApplicationCountByForm(form)); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/java/ddingdong/ddingdongBE/domain/formapplication/api/UserFormApplicationApi.java
(2 hunks)src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/UserFormApplicationController.java
(2 hunks)src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/dto/response/FormApplicationCountResponse.java
(1 hunks)src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationService.java
(1 hunks)src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationServiceImpl.java
(3 hunks)src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/dto/query/FormApplicationCountQuery.java
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and analyze
🔇 Additional comments (6)
src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/dto/query/FormApplicationCountQuery.java (1)
5-14
: 구현이 깔끔하고 적절합니다!불변성을 보장하는 record 타입과 빌더 패턴을 사용한 구현이 매우 적절합니다. 정적 팩토리 메서드를 통한 인스턴스 생성 방식도 가독성이 좋습니다.
src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationService.java (1)
10-10
: 인터페이스 설계가 명확합니다!메서드 시그니처가 명확하고 일관된 패턴을 따르고 있습니다.
src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/dto/response/FormApplicationCountResponse.java (1)
6-16
: 응답 DTO 설계가 적절합니다!내부 DTO(FormApplicationCountQuery)와 외부 응답 DTO의 분리가 잘 되어있고, 변환 메서드도 깔끔하게 구현되어 있습니다.
src/main/java/ddingdong/ddingdongBE/domain/formapplication/controller/UserFormApplicationController.java (1)
26-30
: 인증 검증 로직이 누락된 것 같습니다.
principalDetails
파라미터가 메서드 내에서 사용되지 않고 있습니다. 폼 조회에 대한 권한 검증이 필요한지 확인해 주세요.다음 사항들을 확인해 주시기 바랍니다:
- 폼 조회 시 사용자 권한 검증이 필요한지 여부
- 필요하다면 권한 검증 로직 추가
- 불필요하다면
principalDetails
파라미터 제거 고려src/main/java/ddingdong/ddingdongBE/domain/formapplication/api/UserFormApplicationApi.java (1)
29-37
: API 구조와 문서화가 잘 되어있습니다!OpenAPI 어노테이션을 통한 API 문서화가 명확하게 되어 있으며, RESTful한 엔드포인트 설계가 잘 되어있습니다.
src/main/java/ddingdong/ddingdongBE/domain/formapplication/service/FacadeUserFormApplicationServiceImpl.java (1)
30-30
: 의존성 주입이 잘 되어있습니다.FormStatisticService를 final 필드로 선언하여 불변성을 보장하고 있습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코멘트 변경해주시고 머지하면 될 것 같아요~
@ApiResponse(responseCode = "200", description = "지원자 수 조회 성공", | ||
content = @Content(schema = @Schema(implementation = FormApplicationCountResponse.class))) | ||
@ResponseStatus(HttpStatus.OK) | ||
@GetMapping("/forms/{formId}/applications") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url 더 구체적으로 작성해주면 좋을 것 같아요. 아래와 같이?
@GetMapping("/forms/{formId}/applications") | |
@GetMapping("/forms/{formId}/applications/count") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
졸습니다! 반영하였습니다.
public record FormApplicationCountQuery( | ||
int formApplicationCount | ||
) { | ||
public static FormApplicationCountQuery of(int formApplicationCount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from으로 바꾸면 좋을 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다. 감사합니다!
|
🚀 작업 내용
지원자 수 조회 API 구현하였습니다.
🤔 고민했던 내용
💬 리뷰 중점사항
FormStatisticService의 getTotalApplicationCountByForm() 메서드 사용하였습니다.
Summary by CodeRabbit