-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 회원 리뷰 조회 기능 구현 (#147) * feat: 회원 리뷰 조회 기능 구현 (#147) * test: 회원 리뷰 조회 기능 단위 테스트 (#147) * test: 회원 리뷰 조회 기능 단위 테스트 (service) (#147) * test: 회원 리뷰 조회 기능 통합 테스트 (#147)
- Loading branch information
1 parent
453cc51
commit d24c6a7
Showing
10 changed files
with
182 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
package net.teumteum.user.domain; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import net.teumteum.core.security.Authenticated; | ||
import net.teumteum.user.domain.response.UserReviewsResponse; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.Optional; | ||
|
||
public interface UserRepository extends JpaRepository<User, Long> { | ||
|
||
@Query("select u from users u " + | ||
"where u.oauth.authenticated = :authenticated and u.oauth.oauthId = :oAuthId") | ||
"where u.oauth.authenticated = :authenticated and u.oauth.oauthId = :oAuthId") | ||
Optional<User> findByAuthenticatedAndOAuthId(@Param("authenticated") Authenticated authenticated, | ||
@Param("oAuthId") String oAuthId); | ||
|
||
@Param("oAuthId") String oAuthId); | ||
|
||
@Query("select new net.teumteum.user.domain.response.UserReviewsResponse(r,count(r)) " | ||
+ "from users u join u.reviews r where u.id = :userId group by r") | ||
List<UserReviewsResponse> countUserReviewsByUserId(@Param("userId") Long userId); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/net/teumteum/user/domain/response/UserReviewsResponse.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,10 @@ | ||
package net.teumteum.user.domain.response; | ||
|
||
import net.teumteum.user.domain.Review; | ||
|
||
public record UserReviewsResponse( | ||
Review review, | ||
long count | ||
) { | ||
|
||
} |
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
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
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
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