77import kr .spot .study .domain .Study ;
88import kr .spot .study .domain .associations .StudyCategory ;
99import kr .spot .study .domain .associations .StudyMember ;
10- import kr .spot .study .domain .associations .StudyStats ;
1110import kr .spot .study .domain .enums .Category ;
1211import kr .spot .study .domain .enums .StudyMemberStatus ;
1312import kr .spot .study .infrastructure .jpa .StudyRepository ;
1413import kr .spot .study .infrastructure .jpa .associations .StudyCategoryRepository ;
1514import kr .spot .study .infrastructure .jpa .associations .StudyMemberRepository ;
16- import kr .spot .study .infrastructure .jpa .associations .StudyStatsRepository ;
1715import kr .spot .study .presentation .query .dto .response .GetStudyInfoResponse ;
1816import kr .spot .study .presentation .query .dto .response .GetStudyInfoResponse .Statistics ;
1917import kr .spot .study .presentation .query .dto .response .GetStudyMembersResponse ;
@@ -32,16 +30,14 @@ public class GetStudyDetailService {
3230
3331 private final StudyRepository studyRepository ;
3432 private final StudyCategoryRepository studyCategoryRepository ;
35- private final StudyStatsRepository studyStatsRepository ;
3633 private final StudyMemberRepository studyMemberRepository ;
3734 private final StudyViewCountService studyViewCountService ;
3835 private final GetMemberInfoPort getMemberInfoPort ;
3936
4037 public GetStudyInfoResponse getStudyInfo (long studyId , long viewerId ) {
4138 Study study = findStudy (studyId );
42- StudyStats stats = findStudyStats (studyId );
4339 List <Category > categories = findCategories (studyId );
44- Statistics statistics = buildStatistics (study , stats , studyId , viewerId );
40+ Statistics statistics = buildStatistics (study , studyId , viewerId );
4541
4642 return toStudyInfoResponse (study , categories , statistics );
4743 }
@@ -58,23 +54,19 @@ private Study findStudy(long studyId) {
5854 return studyRepository .getStudyById (studyId );
5955 }
6056
61- private StudyStats findStudyStats (long studyId ) {
62- return studyStatsRepository .getByStudyId (studyId );
63- }
64-
6557 private List <Category > findCategories (long studyId ) {
6658 return studyCategoryRepository .findAllByStudyId (studyId ).stream ()
6759 .map (StudyCategory ::getCategory )
6860 .toList ();
6961 }
7062
71- private Statistics buildStatistics (Study study , StudyStats stats , long studyId , long viewerId ) {
72- long displayViewCount = studyViewCountService .calculateDisplayViewCount (stats , studyId ,
63+ private Statistics buildStatistics (Study study , long studyId , long viewerId ) {
64+ long displayViewCount = studyViewCountService .calculateDisplayViewCount (study , studyId ,
7365 viewerId );
7466 return Statistics .of (
7567 study .getMaxMembers (),
7668 study .getCurrentMembers (),
77- stats .getLikeCount (),
69+ study .getLikeCount (),
7870 displayViewCount
7971 );
8072 }
0 commit comments