Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: 북마크한 게시글 목록 조회 API #281

Merged
merged 3 commits into from
Nov 23, 2024
Merged

Conversation

yumzen
Copy link
Member

@yumzen yumzen commented Nov 21, 2024

#️⃣연관된 이슈

ex) #이슈번호, #이슈번호

📝작업 내용

북마크한 게시글 목록 조회 API

🔎코드 설명 및 참고 사항

💬리뷰 요구사항

@yumzen yumzen added the ✨ Feature 기능 개발 label Nov 21, 2024
@yumzen yumzen self-assigned this Nov 21, 2024
Comment on lines 72 to 90
List<Post> postList = queryFactory
.select(post)
.distinct()
.from(post)
.leftJoin(post.bookmarkList, bookmark).fetchJoin()
.where(bookmark.member.memberId.eq(member.getMemberId())
.and(post.deletedAt.isNull()))
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(bookmark.createdAt.desc(), bookmark.id.desc())
.fetch();

Long total = queryFactory
.select(post.count())
.from(post)
.leftJoin(post.bookmarkList, bookmark)
.where(bookmark.member.memberId.eq(member.getMemberId())
.and(post.deletedAt.isNull()))
.fetchOne();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구한 post들을 반환할 때는 distinct를 사용하는데, total 개수 구할 때는 사용하지 않아서 값에 차이가 생기지는 않나요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그렇네요! 수정하겠습니다~

@yumzen yumzen merged commit e2a6047 into develop Nov 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants