-
Notifications
You must be signed in to change notification settings - Fork 1
[BE] 수업 검색 기능 추가 #208
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
[BE] 수업 검색 기능 추가 #208
Conversation
WalkthroughThe pull request updates the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PCService as ProfessorCourseService
participant Database
Client->>PCService: searchCourses(keyword)
alt Keyword is null/empty
PCService->>Database: Retrieve all courses for professor
else Keyword provided
PCService->>PCService: Escape keyword and construct search pattern
PCService->>Database: Retrieve courses matching keyword filter
end
Database->>PCService: Return course list
PCService->>Client: Return results
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
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
CodeRabbit Configuration File (
|
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)
back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java (1)
108-122: Consider adding pagination for better performance.Since the method eagerly loads schedules for all courses, it might impact performance with large datasets. Consider:
- Adding pagination parameters (page, size)
- Using Spring Data JPA's
Pageablefor both search casesExample implementation:
- public List<CourseSummaryResponse> searchCourses(String oauthId, String keyword) { + public Page<CourseSummaryResponse> searchCourses(String oauthId, String keyword, Pageable pageable) { Professor professor = getProfessorByOauthId(oauthId); List<Course> searchCourses; if (keyword == null || keyword.isEmpty()) { - searchCourses = courseRepository.findCoursesWithSchedulesByProfessor(professor); + searchCourses = courseRepository.findCoursesWithSchedulesByProfessor(professor, pageable); } else { String escapedKeyword = escapeWildcard(keyword); String searchKeyword = "%" + escapedKeyword + "%"; - searchCourses = courseRepository.findCoursesWithSchedulesByProfessorAndKeyword(professor, searchKeyword); + searchCourses = courseRepository.findCoursesWithSchedulesByProfessorAndKeyword(professor, searchKeyword, pageable); } - return getAllCoursesResponse(searchCourses); + return new PageImpl<>(getAllCoursesResponse(searchCourses.getContent()), pageable, searchCourses.getTotalElements()); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java (1)
Learnt from: sunohkim
PR: softeer5th/Team3-PowerPenguin#94
File: back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java:189-202
Timestamp: 2025-02-11T06:18:05.772Z
Learning: The team values clean code and well-structured refactoring, particularly when it involves breaking down complex stream operations into smaller, more focused methods for better maintainability and performance.
🔇 Additional comments (1)
back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java (1)
112-119: LGTM! Clean implementation of the search functionality.The changes effectively handle empty/null keywords while maintaining code clarity and security. The implementation:
- Explicitly handles empty/null keywords by returning all courses
- Properly escapes SQL wildcards to prevent injection
- Maintains clean code structure with clear conditional logic
uri010
left a comment
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.
오호 이렇게 하면 불필요한 과정이 없어져서 더 좋겠네요!
[BE] 수업 검색 기능 추가
#️⃣ 연관된 이슈
#187
📝 작업 내용
수업 검색 기능에서 일부 코드 리팩토링
💬 리뷰 요구사항(선택)
Summary by CodeRabbit