From 8d1edffbc7c0e5d14899a3c4a3e97145211e2340 Mon Sep 17 00:00:00 2001 From: jgmoon <6813821@tukorea.ac.kr> Date: Thu, 15 Feb 2024 01:44:39 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=89=B4=EC=8A=A4=EB=A0=88=ED=84=B0=20?= =?UTF-8?q?=EC=A2=8B=EC=95=84=EC=9A=94=20=EA=B0=9C=EC=88=98=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20(#63)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewsletterLikeRepositoryImpl.java | 24 +++++++++++++++++++ .../NewsletterScrapRepositoryImpl.java | 2 -- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/api/ttoklip/domain/newsletter/like/repository/NewsletterLikeRepositoryImpl.java diff --git a/src/main/java/com/api/ttoklip/domain/newsletter/like/repository/NewsletterLikeRepositoryImpl.java b/src/main/java/com/api/ttoklip/domain/newsletter/like/repository/NewsletterLikeRepositoryImpl.java new file mode 100644 index 00000000..a0aca56c --- /dev/null +++ b/src/main/java/com/api/ttoklip/domain/newsletter/like/repository/NewsletterLikeRepositoryImpl.java @@ -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(); + } + +} diff --git a/src/main/java/com/api/ttoklip/domain/newsletter/scarp/repository/NewsletterScrapRepositoryImpl.java b/src/main/java/com/api/ttoklip/domain/newsletter/scarp/repository/NewsletterScrapRepositoryImpl.java index b207d1a3..400d4c16 100644 --- a/src/main/java/com/api/ttoklip/domain/newsletter/scarp/repository/NewsletterScrapRepositoryImpl.java +++ b/src/main/java/com/api/ttoklip/domain/newsletter/scarp/repository/NewsletterScrapRepositoryImpl.java @@ -20,6 +20,4 @@ public Long countNewsletterScrapsByNewsletterId(final Long newsletterId) { .where(newsletterScrap.newsletter.id.eq(newsletterId)) .fetchOne(); } - - }