-
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
feat: 스터디 주차별 출결번호 조회 #688
Conversation
Walkthrough변경 사항은 Changes
Sequence Diagram(s)sequenceDiagram
participant Mentor
participant Controller
participant Service
participant Repository
Mentor->>Controller: 출결 번호 요청 (studyId)
Controller->>Service: getAttendanceNumbers(studyId)
Service->>Repository: 스터디 세부 정보 조회 (studyId)
Repository-->>Service: 스터디 세부 정보 반환
Service-->>Controller: 출결 번호 리스트 반환
Controller-->>Mentor: 출결 번호 응답
Assessment against linked issues
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyMentorAttendanceResponse.java (1 hunks)
Additional comments not posted (6)
src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyMentorAttendanceResponse.java (4)
1-1
: 패키지 선언 확인패키지 선언이 적절합니다.
코드 변경 사항이 승인되었습니다.
3-5
: 필수 import 확인필수 import가 적절하게 포함되어 있습니다.
코드 변경 사항이 승인되었습니다.
7-11
: 레코드 필드 선언 확인레코드 필드 선언이 적절하며,
@Schema
어노테이션을 사용하여 API 문서화를 돕고 있습니다.코드 변경 사항이 승인되었습니다.
12-18
: 정적 메서드from
구현 확인정적 메서드
from
이StudyDetail
객체를StudyMentorAttendanceResponse
객체로 변환하는 로직이 적절합니다.코드 변경 사항이 승인되었습니다.
src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java (1)
76-82
: 새로운 엔드포인트 메서드 추가 확인새로운 엔드포인트 메서드
getAttendanceNumber
가 적절하게 추가되었습니다.@Operation
어노테이션을 사용하여 API 문서화를 돕고 있으며,studyId
를 요청 파라미터로 받아 출결 번호 목록을 반환합니다.코드 변경 사항이 승인되었습니다.
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (1)
96-107
: 새로운 메서드 추가 확인새로운 메서드
getAttendanceNumber
가 적절하게 추가되었습니다.@Transactional(readOnly = true)
어노테이션을 사용하여 읽기 전용 트랜잭션을 보장하며, 주어진studyId
에 대한 출결 정보를 적절히 필터링하여 반환합니다.코드 변경 사항이 승인되었습니다.
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java
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.
lgtm
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.
메서드명 수정 부탁드려요!
++ 하나 제안 사항도 있습니다~
src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java
Outdated
Show resolved
Hide resolved
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java (1 hunks)
Additional comments not posted (3)
src/main/java/com/gdschongik/gdsc/domain/study/api/MentorStudyDetailController.java (1)
76-82
: 코드 검토 완료: 출결번호 조회 API 추가
getAttendanceNumbers
메서드는 올바르게 구현되었습니다. 예외 처리와 엣지 케이스를 잘 다루고 있는지 확인하시기 바랍니다.코드 변경 사항이 승인되었습니다.
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (1)
96-105
: 코드 검토 완료: 출결번호 조회 서비스 메서드 추가
getAttendanceNumbers
메서드는 올바르게 구현되었습니다. 예외 처리와 엣지 케이스를 잘 다루고 있는지 확인하시기 바랍니다.코드 변경 사항이 승인되었습니다.
src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java (1)
126-129
: 코드 검토 완료: 출석일 확인 메서드 추가
isAttendanceDayPassed
메서드는 올바르게 구현되었습니다. 예외 처리와 엣지 케이스를 잘 다루고 있는지 확인하시기 바랍니다.코드 변경 사항이 승인되었습니다.
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.
미리 approve 남겨요!
같이 남긴 코멘트 확인해주세요!
@@ -123,6 +123,11 @@ public LocalDate getAttendanceDay() { | |||
return startDate.plusDays(daysToAdd); | |||
} | |||
|
|||
// 출석일이 오늘 or 오늘이후인지 확인 | |||
public boolean isAttendanceDayPassed(LocalDate now) { |
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.
엄밀히 따지자면 isAttendanceDayNotPassed가 맞는 것 같습니다.
++ now를 메서드에서 직접 호출하지 않는 이유가 있나요?
메서드 참조를 활용하면 좋을 것 같아서요!
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.
네 메소드 명은 변경하겠습니다.
now를 받도록 한 이유는 추후 다른 테스트 or 로직에서 사용하게 될떄 테스트할때 용이하도록 하기 위해서 이렇게 한거에요!!
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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: 1
Outside diff range, codebase verification and nitpick comments (1)
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (1)
96-105
: 메서드 이름을 더 설명적으로 변경하세요.
getAttendanceNumbers
라는 이름은 이 메서드가 정확히 무엇을 하는지 명확하지 않습니다. 예를 들어,getFutureAttendanceNumbers
또는getUpcomingAttendanceNumbers
와 같은 이름이 더 적절할 수 있습니다.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java
Additional comments not posted (1)
src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailService.java (1)
100-102
: 필터링 로직을StudyDetail
엔티티로 캡슐화하세요.
studyDetail.isAttendanceDayNotPassed(LocalDate.now())
와 같은 중요한 로직은StudyDetail
엔티티에 메서드로 캡슐화하는 것이 좋습니다. 이는 코드의 가독성과 유지보수성을 높입니다.
public List<StudyMentorAttendanceResponse> getAttendanceNumbers(Long studyId) { | ||
List<StudyDetail> studyDetails = studyDetailRepository.findAllByStudyIdOrderByWeekAsc(studyId); | ||
|
||
// 출석일이 오늘 or 오늘이후인 StudyDetail | ||
return studyDetails.stream() | ||
.filter(studyDetail -> studyDetail.isAttendanceDayNotPassed(LocalDate.now())) | ||
.map(StudyMentorAttendanceResponse::from) | ||
.toList(); | ||
} |
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.
예외 처리 및 엣지 케이스를 고려하세요.
현재 메서드는 예외 처리나 엣지 케이스를 고려하지 않고 있습니다. 예를 들어, studyDetailRepository.findAllByStudyIdOrderByWeekAsc(studyId)
가 빈 리스트를 반환할 경우를 처리하는 로직이 필요할 수 있습니다.
다음과 같은 코드를 추가하여 예외 처리를 강화할 수 있습니다:
@Transactional(readOnly = true)
public List<StudyMentorAttendanceResponse> getAttendanceNumbers(Long studyId) {
List<StudyDetail> studyDetails = studyDetailRepository.findAllByStudyIdOrderByWeekAsc(studyId);
if (studyDetails.isEmpty()) {
throw new CustomException(STUDY_DETAILS_NOT_FOUND);
}
return studyDetails.stream()
.filter(studyDetail -> studyDetail.isAttendanceDayNotPassed(LocalDate.now()))
.map(StudyMentorAttendanceResponse::from)
.toList();
}
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.
public List<StudyMentorAttendanceResponse> getAttendanceNumbers(Long studyId) { | |
List<StudyDetail> studyDetails = studyDetailRepository.findAllByStudyIdOrderByWeekAsc(studyId); | |
// 출석일이 오늘 or 오늘이후인 StudyDetail | |
return studyDetails.stream() | |
.filter(studyDetail -> studyDetail.isAttendanceDayNotPassed(LocalDate.now())) | |
.map(StudyMentorAttendanceResponse::from) | |
.toList(); | |
} | |
@Transactional(readOnly = true) | |
public List<StudyMentorAttendanceResponse> getAttendanceNumbers(Long studyId) { | |
List<StudyDetail> studyDetails = studyDetailRepository.findAllByStudyIdOrderByWeekAsc(studyId); | |
if (studyDetails.isEmpty()) { | |
throw new CustomException(STUDY_DETAILS_NOT_FOUND); | |
} | |
return studyDetails.stream() | |
.filter(studyDetail -> studyDetail.isAttendanceDayNotPassed(LocalDate.now())) | |
.map(StudyMentorAttendanceResponse::from) | |
.toList(); | |
} |
…into feature/687-get-mentor-attendace-number
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타
Summary by CodeRabbit
New Features
StudyMentorAttendanceResponse
객체를 반환하는 메서드 추가.Documentation