Skip to content

Commit 086b533

Browse files
authored
Merge pull request #41 from prgrms-web-devcourse-final-project/feature/mypage
fix : 팔로우/팔로잉 조회 오류 수정
2 parents 5496b17 + f41d24b commit 086b533

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/main/java/com/example/log4u/domain/follow/repository/FollowQuerydsl.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ public FollowQuerydsl() {
2525
super(Follow.class);
2626
}
2727

28-
private NumberPath<Long> getNumberPath(boolean isFollowTarget) {
29-
return isFollowTarget ? follow.targetId : follow.initiatorId;
30-
}
31-
3228
private BooleanBuilder getBooleanBuilder(boolean isFollowTarget, Long userId, Long cursorId, String keyword) {
3329
BooleanBuilder builder = new BooleanBuilder();
34-
NumberPath<Long> numberPath = getNumberPath(isFollowTarget);
30+
NumberPath<Long> numberPath = isFollowTarget ? follow.targetId : follow.initiatorId;
3531

3632
builder.and(numberPath.eq(userId));
3733

@@ -50,15 +46,13 @@ private List<UserThumbnailResponseDto> getContent(boolean isFollowTarget, Long u
5046
String keyword) {
5147
BooleanBuilder builder = getBooleanBuilder(isFollowTarget, userId, cursorId, keyword);
5248

53-
NumberPath<Long> numberPath = getNumberPath(isFollowTarget);
49+
NumberPath<Long> numberPath = isFollowTarget ? follow.targetId : follow.initiatorId;
50+
NumberPath<Long> numberPath2 = isFollowTarget ? follow.initiatorId : follow.targetId;
5451

55-
return from(follow)
56-
.innerJoin(user)
52+
return from(follow).innerJoin(user)
5753
.on(user.userId.eq(numberPath))
58-
.select(Projections.constructor(UserThumbnailResponseDto.class,
59-
numberPath,
60-
user.nickname,
61-
user.profileImage))
54+
.select(
55+
Projections.constructor(UserThumbnailResponseDto.class, numberPath2, user.nickname, user.profileImage))
6256
.where(builder)
6357
.distinct()
6458
.fetch();

0 commit comments

Comments
 (0)