diff --git a/src/main/java/spring/backend/activity/application/ReadActivitiesByMemberAndKeywordInMonthService.java b/src/main/java/spring/backend/activity/application/ReadActivitiesByMemberAndKeywordInMonthService.java index cc1f73625..a1049f43a 100644 --- a/src/main/java/spring/backend/activity/application/ReadActivitiesByMemberAndKeywordInMonthService.java +++ b/src/main/java/spring/backend/activity/application/ReadActivitiesByMemberAndKeywordInMonthService.java @@ -29,7 +29,7 @@ public ActivitiesByMemberAndKeywordInMonthResponse readActivitiesByMemberAndKeyw LocalDateTime endDayOfMonth = TimeUtil.toEndDayOfMonth(yearMonth); List activities = activityDao.findActivitiesByMemberAndKeywordInMonth(member.getId(), firstDayOfMonth, endDayOfMonth, keywordCategory); TotalSavedTimeAndActivityCountByKeywordInMonth totalSavedTimeAndActivityCountByKeywordInMonth = activityDao.findTotalSavedTimeAndActivityCountByKeywordInMonth(member.getId(), firstDayOfMonth, endDayOfMonth, keywordCategory); - Keyword keyword = Keyword.create(keywordCategory, imageConverter.convertToTransparent30ImageUrl(keywordCategory)); + Keyword keyword = Keyword.create(keywordCategory, imageConverter.convertToImageUrl(keywordCategory)); return new ActivitiesByMemberAndKeywordInMonthResponse( totalSavedTimeAndActivityCountByKeywordInMonth.totalSavedTimeByKeywordInMonth(), totalSavedTimeAndActivityCountByKeywordInMonth.totalActivityCountByKeywordInMonth(), diff --git a/src/main/java/spring/backend/activity/application/ReadMonthlyActivityOverviewService.java b/src/main/java/spring/backend/activity/application/ReadMonthlyActivityOverviewService.java index 937faa754..f435914f7 100644 --- a/src/main/java/spring/backend/activity/application/ReadMonthlyActivityOverviewService.java +++ b/src/main/java/spring/backend/activity/application/ReadMonthlyActivityOverviewService.java @@ -4,11 +4,14 @@ import lombok.extern.log4j.Log4j2; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import spring.backend.activity.domain.value.Keyword.Category; import spring.backend.activity.dto.request.MonthlyActivityOverviewRequest; import spring.backend.activity.dto.response.MonthlyActivityCountByKeywordResponse; import spring.backend.activity.dto.response.MonthlyActivityOverviewResponse; import spring.backend.activity.dto.response.MonthlySavedTimeAndActivityCountResponse; +import spring.backend.activity.infrastructure.persistence.jpa.value.KeywordJpaValue; import spring.backend.activity.query.dao.ActivityDao; +import spring.backend.core.converter.ImageConverter; import spring.backend.core.util.TimeUtil; import spring.backend.member.domain.entity.Member; @@ -24,12 +27,22 @@ public class ReadMonthlyActivityOverviewService { private final ActivityDao activityDao; + private final ImageConverter imageConverter; + public MonthlyActivityOverviewResponse readMonthlyActivityOverview(Member member, MonthlyActivityOverviewRequest monthlyActivityOverviewRequest) { YearMonth yearMonth = YearMonth.of(monthlyActivityOverviewRequest.year(), monthlyActivityOverviewRequest.month()); LocalDateTime startDayOfMonth = TimeUtil.toStartDayOfMonth(yearMonth); LocalDateTime endDayOfMonth = TimeUtil.toEndDayOfMonth(yearMonth); MonthlySavedTimeAndActivityCountResponse monthlySavedTimeAndActivityCountResponse = activityDao.findMonthlyTotalSavedTimeAndTotalCount(member.getId(), startDayOfMonth, endDayOfMonth); List activityByKeywordSummaryResponses = activityDao.findMonthlyActivitiesByKeywordSummary(member.getId(), startDayOfMonth, endDayOfMonth); - return new MonthlyActivityOverviewResponse(member.getUpdatedAt().getYear(), member.getUpdatedAt().getMonth(), monthlySavedTimeAndActivityCountResponse, activityByKeywordSummaryResponses); + List updatedActivityByKeywordSummaryResponses = activityByKeywordSummaryResponses.stream() + .map(response -> { + Category category = response.keyword().getCategory(); + String imageUrl = imageConverter.convertToTransparent30ImageUrl(category); + KeywordJpaValue updatedKeyword = KeywordJpaValue.create(category, imageUrl); + return new MonthlyActivityCountByKeywordResponse(updatedKeyword, response.activityCount()); + }) + .toList(); + return new MonthlyActivityOverviewResponse(member.getUpdatedAt().getYear(), member.getUpdatedAt().getMonth(), monthlySavedTimeAndActivityCountResponse, updatedActivityByKeywordSummaryResponses); } }