Skip to content

Conversation

@Kimsejin-56
Copy link
Contributor

No description provided.

@Kimsejin-56 Kimsejin-56 merged commit 8954e83 into main Nov 20, 2025
1 check passed
Copy link

@ggamnunq ggamnunq left a 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 {

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)

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;

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입에 맞는 제네릭 타입을 쓰는게 좋을 듯 합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants