-
Notifications
You must be signed in to change notification settings - Fork 0
UMC 9주차 과제 #8
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
UMC 9주차 과제 #8
Conversation
ggamnunq
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.
good
| import java.util.stream.Collectors; | ||
|
|
||
| @Component | ||
| public class MissionConverter { |
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.
단순히 값을 변환하는 컨버터에는 빈으로 등록하지 않고 static 메서드로 선언해도 충분해요!
| public List<UserMissionInProgressResponse> getUserInProgress(Long userId, int pageIndex) { | ||
| Pageable pageable = PageRequest.of(pageIndex, 10); | ||
| return converter.toUserMissionList( | ||
| userMissionRepository.findByUserIdAndStatus(userId, MissionStatus.PROCESS, pageable) |
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.
repository에서 조회하는 부분은 따로 빼서 가독성을 높여줍시다
| @RequestParam Long userId, | ||
| @RequestParam(defaultValue = "1") @ValidPage Integer page | ||
| ) { | ||
| int pageIndex = page - 1; |
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 List<MyReviewResponse> getMyReviews(Long userId, int pageIndex) { | ||
|
|
||
| Pageable pageable = PageRequest.of(pageIndex, 10, Sort.by("createdAt").descending()); | ||
| Page<?> result = reviewRepository.findByUserId(userId, pageable); |
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.
타입에 맞는 제네릭 타입을 쓰는게 좋을 듯 합니다.
No description provided.