Skip to content

Commit

Permalink
YEL-220 [deploy] 타임라인 페이징 개수 버그 해결
Browse files Browse the repository at this point in the history
YEL-220 [deploy] 타임라인 페이징 개수 버그 해결
  • Loading branch information
hyeonjeongs authored Feb 25, 2024
2 parents 344f8e4 + 7145470 commit 5ff1315
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ public interface VoteJpaRepository extends JpaRepository<Vote, Long> {

@Query("select v from Vote v where v.receiver.id in "
+ "(select f.target.id from Friend f where f.user.id = :userId and f.deletedAt is null) "
+ "and v.nameHint != -3 "
+ "and v.sender.deletedAt is null "
+ "and v.receiver.deletedAt is null "
+ "order by v.createdAt desc")
List<Vote> findAllReceivedByFriends(@Param("userId") Long userId, Pageable pageable);

@Query("select count(v) from Vote v where v.receiver.id in "
+ "(select f.target.id from Friend f where f.user.id = :userId and f.deletedAt is null) "
+ "and v.nameHint != -3 "
+ "and v.sender.deletedAt is null "
+ "and v.receiver.deletedAt is null "
+ "order by v.createdAt desc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public List<Vote> findUserSendReceivedByFriends(Long userId, Pageable pageable)
.where(friend.user.id.eq(userId)
.and(friend.deletedAt.isNull())
)))
.and(vote.nameHint.ne(-3))
.and(vote.sender.deletedAt.isNull())
.and(vote.receiver.deletedAt.isNull()))
.orderBy(vote.createdAt.desc())
Expand All @@ -120,6 +121,7 @@ public Long countUserSendReceivedByFriends(Long userId) {
.where(friend.user.id.eq(userId)
.and(friend.deletedAt.isNull())
)))
.and(vote.nameHint.ne(-3))
.and(vote.sender.deletedAt.isNull())
.and(vote.receiver.deletedAt.isNull()))
.fetchOne();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public VoteFriendResponse findAllFriendVotes(Long userId, Pageable pageable) {
final Integer totalCount = voteRepository.countAllReceivedByFriends(userId);
final List<VoteFriendVO> list = voteRepository.findAllReceivedByFriends(userId, pageable)
.stream()
.filter(vote -> vote.getNameHint()!=-3)
.map(VoteFriendVO::of)
.toList();
return VoteFriendResponse.of(totalCount, list);
Expand All @@ -124,7 +123,6 @@ public VoteFriendAndUserResponse findAllFriendVotesWithType(Long userId, Pageabl
final Long totalCount = Long.valueOf(voteRepository.countAllReceivedByFriends(userId));
final List<VoteFriendAndUserVO> list = voteRepository.findAllReceivedByFriends(userId, pageable)
.stream()
.filter(vote -> vote.getNameHint()!=-3)
.map(vote -> VoteFriendAndUserVO.of(vote, vote.getSender().getId().equals(userId)))
.toList();
return VoteFriendAndUserResponse.of(totalCount, list);
Expand All @@ -136,7 +134,6 @@ public VoteFriendAndUserResponse findAllFriendVotesWithType(Long userId, Pageabl
List<VoteFriendAndUserVO> list =
voteRepository.findUserSendReceivedByFriends(userId, pageable)
.stream()
.filter(vote -> vote.getNameHint()!=-3)
.map(vote -> VoteFriendAndUserVO.of(vote, vote.getSender().getId().equals(userId)))
.toList();
return VoteFriendAndUserResponse.of(totalCount,list);
Expand Down

0 comments on commit 5ff1315

Please sign in to comment.