Skip to content

Commit

Permalink
fix: 잘못된 newsletter getActivatedNewsletterFromComments() query 수정 (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip authored Sep 5, 2024
1 parent 381c918 commit 253f7d7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ private BooleanExpression getActivatedNewsletter() {
return newsletter.deleted.isFalse();
}

private BooleanExpression getActivatedNewsletterFromComments() {
return newsletterComment.newsletter.deleted.isFalse();
}

@Override
public Newsletter findByIdFetchJoin(Long newsletterPostId) {
Newsletter findNewsletter = jpaQueryFactory
Expand All @@ -80,10 +84,10 @@ public List<NewsletterComment> findActiveCommentsByNewsletterId(Long newsletterI
return jpaQueryFactory
.selectFrom(newsletterComment)
.distinct()
.leftJoin(newsletter.member, member).fetchJoin()
.leftJoin(newsletterComment.member, member).fetchJoin()
.where(
matchNewsletterId(newsletterId),
getActivatedNewsletter()
getActivatedNewsletterFromComments()
)
.orderBy(
newsletterComment.parent.id.asc().nullsFirst(),
Expand All @@ -92,6 +96,7 @@ public List<NewsletterComment> findActiveCommentsByNewsletterId(Long newsletterI
.fetch();
}


private BooleanExpression matchNewsletterId(final Long newsletterId) {
return newsletterComment.newsletter.id.eq(newsletterId);
}
Expand Down

0 comments on commit 253f7d7

Please sign in to comment.