-
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: 과제 조회 API 추가 #543
feat: 과제 조회 API 추가 #543
Conversation
Caution Review failedThe pull request is closed. Walkthrough변경 사항은 멘토를 위한 과제 조회 API를 구현하여 주차별 과제 목록과 개별 과제 내용을 조회하는 기능을 추가합니다. 새로운 Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant MC as StudyMentorController
participant MS as StudyMentorService
participant R as StudyDetailRepository
C->>MC: GET /studies/{studyId}/assignments
MC->>MS: getWeeklyAssignments(studyId)
MS->>R: findAllByStudyId(studyId)
R-->>MS: List<StudyDetail>
MS-->>MC: List<AssignmentResponse>
MC-->>C: ResponseEntity<List<AssignmentResponse>>
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: 1
Outside diff range, codebase verification and nitpick comments (1)
src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (1)
29-34
:studyMentorService.getWeeklyAssignments
메서드의 오류 처리가 부족합니다.현재 메서드는 올바르게 구현되어 있지만,
studyDetailRepository.findAllByStudyId(studyId)
가 빈 리스트나 null을 반환하는 경우를 처리하는 오류 처리가 필요합니다.
StudyMentorService.java
파일의getWeeklyAssignments
메서드에 적절한 오류 처리를 추가하세요.Analysis chain
studyMentorService.getWeeklyAssignments
메서드의 오류 처리를 확인하세요.현재 메서드는 올바르게 구현되어 있습니다. 그러나
studyMentorService.getWeeklyAssignments
메서드가 오류를 적절히 처리하는지 확인해야 합니다.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in `studyMentorService.getWeeklyAssignments`. # Test: Search for the method implementation. Expect: Proper error handling. rg --type java -A 10 $'public List<AssignmentResponse> getWeeklyAssignments'Length of output: 1540
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dao/StudyDetailRepository.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/domain/study/dto/response/AssignmentResponse.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
Additional context used
Learnings (1)
src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1)
Learnt from: Sangwook02 PR: GDSC-Hongik/gdsc-server#431 File: src/main/java/com/gdschongik/gdsc/domain/study/application/StudyService.java:50-57 Timestamp: 2024-07-07T15:32:34.451Z Learning: Consider using Stream API for creating lists in a more concise and potentially performant manner compared to traditional for-loops.
Additional comments not posted (6)
src/main/java/com/gdschongik/gdsc/domain/study/dao/StudyDetailRepository.java (2)
4-4
: 필요한 import 추가
List
를 사용하기 위해 필요한 import가 추가되었습니다.
7-10
: 새로운 메서드 추가
StudyDetailRepository
인터페이스에findAllByStudyId
메서드가 추가되었습니다. 이 메서드는 특정studyId
에 대한StudyDetail
엔티티를 반환합니다.src/main/java/com/gdschongik/gdsc/domain/study/dto/response/AssignmentResponse.java (1)
1-23
: 새로운AssignmentResponse
레코드 추가
AssignmentResponse
레코드는 과제의 세부 정보를 캡슐화합니다.from
메서드는StudyDetail
객체를AssignmentResponse
로 변환합니다.src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1)
1-34
: 새로운StudyMentorService
클래스 추가
StudyMentorService
클래스는 과제 데이터를 조회하는 두 가지 메서드를 포함합니다.getWeeklyAssignments
메서드는 Stream API를 사용하여StudyDetail
엔티티를AssignmentResponse
로 변환합니다.src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (1)
36-41
:studyMentorService.getAssignment
메서드의 오류 처리를 확인하세요.현재 메서드는 올바르게 구현되어 있습니다. 그러나
studyMentorService.getAssignment
메서드가 오류를 적절히 처리하는지 확인해야 합니다.Verification successful
studyMentorService.getAssignment
메서드는 오류를 적절히 처리합니다.
studyMentorService.getAssignment
메서드는StudyDetail
을 찾지 못했을 때CustomException
을 던지도록 구현되어 있어 오류 처리가 적절합니다.
StudyMentorService.java
의getAssignment
메서드에서CustomException
을 사용하여 오류를 처리하는 부분을 확인했습니다.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in `studyMentorService.getAssignment`. # Test: Search for the method implementation. Expect: Proper error handling. rg --type java -A 10 $'public AssignmentResponse getAssignment'Length of output: 950
src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1)
112-114
: 새로운 오류 코드STUDY_DETAIL_NOT_FOUND
의 사용을 확인하세요.새로운 오류 코드는 올바르게 추가되었습니다. 코드베이스에서 적절히 사용되고 있는지 확인해야 합니다.
Verification successful
새로운 오류 코드
STUDY_DETAIL_NOT_FOUND
가 코드베이스에서 올바르게 사용되고 있습니다.
src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the new error code `STUDY_DETAIL_NOT_FOUND`. # Test: Search for the error code usage. Expect: Proper usage in the codebase. rg --type java 'ErrorCode.STUDY_DETAIL_NOT_FOUND'Length of output: 49
Script:
#!/bin/bash # Description: Verify the usage of the new error code `STUDY_DETAIL_NOT_FOUND`. # Test: Search for the usage of `STUDY_DETAIL_NOT_FOUND` in the codebase. rg --type java 'STUDY_DETAIL_NOT_FOUND'Length of output: 344
|
||
@Operation(summary = "스터디 과제 개설", description = "멘토만 과제를 개설할 수 있습니다.") | ||
@PutMapping("/assignment/{assignmentId}") | ||
public ResponseEntity<Void> createStudyAssignment( | ||
@PathVariable Long assignmentId, @Valid @RequestBody AssignmentCreateRequest request) { | ||
return null; | ||
} |
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.
createStudyAssignment
메서드의 반환값을 수정하세요.
현재 메서드는 null
을 반환하고 있습니다. 적절한 ResponseEntity
를 반환하도록 수정해야 합니다.
- return null;
+ studyMentorService.createAssignment(assignmentId, request);
+ return ResponseEntity.ok().build();
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.
@Operation(summary = "스터디 과제 개설", description = "멘토만 과제를 개설할 수 있습니다.") | |
@PutMapping("/assignment/{assignmentId}") | |
public ResponseEntity<Void> createStudyAssignment( | |
@PathVariable Long assignmentId, @Valid @RequestBody AssignmentCreateRequest request) { | |
return null; | |
} | |
@Operation(summary = "스터디 과제 개설", description = "멘토만 과제를 개설할 수 있습니다.") | |
@PutMapping("/assignment/{assignmentId}") | |
public ResponseEntity<Void> createStudyAssignment( | |
@PathVariable Long assignmentId, @Valid @RequestBody AssignmentCreateRequest request) { | |
studyMentorService.createAssignment(assignmentId, request); | |
return ResponseEntity.ok().build(); | |
} |
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.
lgtm
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) |
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.
메서드 레벨로 내려주세요
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
🌱 관련 이슈
📌 작업 내용 및 특이사항
과제 목록 조회
와과제 상세 조회
api를 구현했습니다.📝 참고사항
📚 기타
Summary by CodeRabbit
신규 기능
버그 수정
문서화
AssignmentResponse
추가.