Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #134 from News-Sseuk/FIX#45
Browse files Browse the repository at this point in the history
[FIX] 스크랩 기사 불러오는 조건 수정 (lastArticleId가 null일 때)
  • Loading branch information
gahyun02 authored Nov 20, 2024
2 parents 7b438f6 + 9402e10 commit 812e7ac
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public List<Article> getUserArticleByCategory(User user, Category category, Stri
.where(
qScrap.user.eq(user)
.and(qScrap.article.category.eq(category))
.and(getLastArticleIdCondition(qScrap, lastArticleId))
.and(lastArticleId != null ? getLastArticleIdCondition(qScrap, lastArticleId) : null)
)
.orderBy(qScrap.article.id.asc()) // 최신순 정렬
.limit(3) // 페이지당 몇개의 데이터를 보여줄껀지
Expand All @@ -40,7 +40,7 @@ public List<Article> getUserArticleByCategory(User user, Category category, Stri

private BooleanExpression getLastArticleIdCondition(QScrap qScrap, String lastArticleId) {
Article jpaArticle = jpaArticleService.findByMongoId(lastArticleId);
return lastArticleId != null ? qScrap.article.id.gt(jpaArticle.getId()) : null;
return qScrap.article.id.gt(jpaArticle.getId());
}

@Override
Expand Down

0 comments on commit 812e7ac

Please sign in to comment.