Skip to content

Commit

Permalink
feat: 뉴스레터 좋아요 개수 조회 쿼리 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
why-only-english committed Feb 14, 2024
1 parent fb35fb9 commit 8d1edff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.api.ttoklip.domain.newsletter.like.repository;

import com.querydsl.core.types.dsl.Wildcard;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;

import static com.api.ttoklip.domain.newsletter.like.entity.QNewsletterLike.newsletterLike;


@RequiredArgsConstructor
public class NewsletterLikeRepositoryImpl implements NewsletterLikeRepositoryCustom {

private final JPAQueryFactory jpaQueryFactory;

@Override
public Long countNewsletterLikesByNewsletterId(final Long newsletterId) {
return jpaQueryFactory
.select(Wildcard.count)
.from(newsletterLike)
.where(newsletterLike.newsletter.id.eq(newsletterId))
.fetchOne();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ public Long countNewsletterScrapsByNewsletterId(final Long newsletterId) {
.where(newsletterScrap.newsletter.id.eq(newsletterId))
.fetchOne();
}


}

0 comments on commit 8d1edff

Please sign in to comment.