Skip to content

Commit

Permalink
edit : NeighborCondition 없이도 친구 조회하도록 변경 #128
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Dec 13, 2023
1 parent ff46482 commit cfbf38e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public List<RetrieveNeighborDTO> searchNeighbors(Long userId) {
}

public Slice<RetrieveNeighborDTO> searchNeighbors(
NeighborCondition neighborCondition, Pageable pageable) {
return neighborRepository.searchNeighborsToPage(neighborCondition, pageable);
Long userId, Pageable pageable) {
return neighborRepository.searchNeighborsToPage(userId, pageable);
}

public boolean existsNeighbor(Long userId, Long neighborId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public interface NeighborCustomRepository {
List<RetrieveNeighborDTO> searchBirthdayNeighbors(Long userId);

Slice<RetrieveNeighborDTO> searchNeighborsToPage(
NeighborCondition neighborCondition, Pageable pageable);
Long userId, Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ public List<RetrieveNeighborDTO> searchBirthdayNeighbors(Long userId) {
.join(user)
.on(user.id.eq(neighbor.toUserId))
.where(
neighbor.fromUserId.eq(neighborCondition.getCurrentUserId()),
neighbor.toUserId.notIn(neighborCondition.getBlockedUserIdList()),
user.profile.birth.contains(monthAndYear),
neighbor.toUserId.in(neighborCondition.getFriendIdList()))
neighbor.fromUserId.eq(userId),
user.profile.birth.contains(monthAndYear))
.orderBy(neighbor.order.asc())
.fetch();
}

@Override
public Slice<RetrieveNeighborDTO> searchNeighborsToPage(
NeighborCondition neighborCondition, Pageable pageable) {
Long userId, Pageable pageable) {
List<RetrieveNeighborDTO> retrieveNeighborDTOS =
queryFactory
.select(
Expand All @@ -104,9 +102,7 @@ public Slice<RetrieveNeighborDTO> searchNeighborsToPage(
.join(user)
.on(user.id.eq(neighbor.toUserId))
.where(
neighbor.fromUserId.eq(neighborCondition.getCurrentUserId()),
neighbor.toUserId.notIn(neighborCondition.getBlockedUserIdList()),
neighbor.toUserId.in(neighborCondition.getFriendIdList()))
neighbor.fromUserId.eq(userId))
.orderBy(neighbor.order.asc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
Expand Down

0 comments on commit cfbf38e

Please sign in to comment.