-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java/kr/co/studyhubinu/studyhubserver/study/StudyRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package kr.co.studyhubinu.studyhubserver.study; | ||
|
||
import kr.co.studyhubinu.studyhubserver.study.domain.StudyEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface StudyRepository extends JpaRepository<StudyEntity, Long> { | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/kr/co/studyhubinu/studyhubserver/user/domain/UserActivityFinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package kr.co.studyhubinu.studyhubserver.user.domain; | ||
|
||
import kr.co.studyhubinu.studyhubserver.bookmark.repository.BookMarkRepository; | ||
import kr.co.studyhubinu.studyhubserver.study.StudyRepository; | ||
import kr.co.studyhubinu.studyhubserver.studypost.repository.StudyPostRepository; | ||
import kr.co.studyhubinu.studyhubserver.user.dto.data.UserActivityCountData; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserActivityFinder { | ||
|
||
private final StudyPostRepository studyPostRepository; | ||
private final BookMarkRepository bookMarkRepository; | ||
private final StudyRepository studyRepository; | ||
|
||
public UserActivityCountData countUserActivity(Long userId) { | ||
Long postCount = studyPostRepository.countByPostedUserId(userId); | ||
Long participateCount = 0L; | ||
Long bookmarkCount = bookMarkRepository.countByUserId(userId); | ||
return new UserActivityCountData(postCount, participateCount, bookmarkCount); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/kr/co/studyhubinu/studyhubserver/user/dto/data/UserActivityCountData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package kr.co.studyhubinu.studyhubserver.user.dto.data; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class UserActivityCountData { | ||
private Long postCount; | ||
private Long participateCount; | ||
private Long bookmarkCount; | ||
|
||
public UserActivityCountData(Long postCount, Long participateCount, Long bookmarkCount) { | ||
this.postCount = postCount; | ||
this.participateCount = participateCount; | ||
this.bookmarkCount = bookmarkCount; | ||
} | ||
} |
11 changes: 9 additions & 2 deletions
11
src/main/java/kr/co/studyhubinu/studyhubserver/user/dto/response/GetUserResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters