Skip to content

Commit 569f1d6

Browse files
authored
Merge pull request #192 from PROJECT-NEXUS-JS/fix/mypage-dashboard-thumbnail
fix: Mypage 대시보드 관련 Dto 수정
2 parents 0576d75 + 2ea80b2 commit 569f1d6

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/main/java/com/example/nexus/app/mypage/dto/RecentlyViewedTestDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class RecentlyViewedTestDto {
1212
private String category;
1313
private String title;
1414
private String oneLineIntro;
15+
private String thumbnailUrl;
1516
private List<String> tags;
1617
private LocalDateTime viewedAt;
1718
}

src/main/java/com/example/nexus/app/mypage/service/MyPageService.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public DashboardDto getDashboardData(Long userId) {
5555
.category(post.getMainCategory().stream().map(Enum::toString).collect(Collectors.joining(", ")))
5656
.title(post.getTitle())
5757
.oneLineIntro(post.getServiceSummary())
58+
.thumbnailUrl(post.getThumbnailUrl())
5859
.tags(post.getGenreCategories().stream().map(Enum::toString).collect(Collectors.toList()))
5960
.viewedAt(recentView.getViewedAt())
6061
.build();
@@ -100,7 +101,7 @@ public TotalParticipationDto getTotalParticipationData(Long userId) {
100101

101102
List<Participation> participated = participationRepository.findByUserIdAndStatusWithPost(userId, ParticipationStatus.APPROVED, Pageable.unpaged()).getContent();
102103

103-
List<Post> participatedPosts = participated.stream().map(Participation::getPost).collect(Collectors.toList());
104+
List<Post> participatedPosts = participated.stream().map(Participation::getPost).toList();
104105
int totalCount = participatedPosts.size();
105106

106107
Map<String, Integer> countByCategory = participatedPosts.stream()
@@ -133,10 +134,10 @@ public ProfileDto getProfileData(Long userId) {
133134
.build();
134135
}
135136

136-
Long testsUploaded = postRepository.countByCreatedBy(userId);
137-
Long testsParticipating = participationRepository.countByUserIdAndStatus(userId, ParticipationStatus.APPROVED);
137+
long testsUploaded = postRepository.countByCreatedBy(userId);
138+
long testsParticipating = participationRepository.countByUserIdAndStatus(userId, ParticipationStatus.APPROVED);
138139

139-
int testsOngoing = testsParticipating.intValue();
140+
int testsOngoing = (int) testsParticipating;
140141

141142
String affiliation = postRepository.findFirstByCreatedByAndStatusOrderByCreatedAtDesc(userId, PostStatus.ACTIVE)
142143
.map(Post::getCreatorIntroduction)
@@ -146,8 +147,8 @@ public ProfileDto getProfileData(Long userId) {
146147
.profileImageUrl(user.getProfileUrl())
147148
.name(user.getNickname())
148149
.affiliation(affiliation)
149-
.testsUploaded(testsUploaded.intValue())
150-
.testsParticipating(testsParticipating.intValue())
150+
.testsUploaded((int) testsUploaded)
151+
.testsParticipating((int) testsParticipating)
151152
.testsOngoing(testsOngoing)
152153
.build();
153154
}

0 commit comments

Comments
 (0)