diff --git a/module-domain/src/main/java/com/mile/curious/repository/CuriousRepositoryCustomImpl.java b/module-domain/src/main/java/com/mile/curious/repository/CuriousRepositoryCustomImpl.java index 5e832f33..ac12ef84 100644 --- a/module-domain/src/main/java/com/mile/curious/repository/CuriousRepositoryCustomImpl.java +++ b/module-domain/src/main/java/com/mile/curious/repository/CuriousRepositoryCustomImpl.java @@ -28,6 +28,7 @@ public List findMostCuriousPostBeforeOneWeek(fina .join(curious.post, post) .join(topic).on(post.topic.id.eq(topic.id)) .join(moim).on(topic.moim.id.eq(moim.id)) + .join(post.writerName).fetchJoin() .where(moim.id.eq(targetMoim.getId())) .where(curious.createdAt.between(now.minusDays(WEEK), now)) .groupBy(post.id) @@ -41,6 +42,7 @@ public List findPostByLatestCurious(final Moim targetMoim, final int reque .join(curious.post, post) .join(topic).on(post.topic.id.eq(topic.id)) .join(moim).on(topic.moim.id.eq(moim.id)) + .join(post.writerName).fetchJoin() .where(moim.id.eq(targetMoim.getId())) .where(post.notIn(posts)) .orderBy(curious.createdAt.desc()) diff --git a/module-domain/src/main/java/com/mile/moim/repository/MoimPopularInfoRepository.java b/module-domain/src/main/java/com/mile/moim/repository/MoimPopularInfoRepository.java index 5de7304c..b3da005d 100644 --- a/module-domain/src/main/java/com/mile/moim/repository/MoimPopularInfoRepository.java +++ b/module-domain/src/main/java/com/mile/moim/repository/MoimPopularInfoRepository.java @@ -2,7 +2,6 @@ import com.mile.moim.domain.popular.MoimPopularInfo; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.Repository; import org.springframework.scheduling.annotation.Scheduled; import java.util.Optional; diff --git a/module-domain/src/main/java/com/mile/moim/repository/MoimRepository.java b/module-domain/src/main/java/com/mile/moim/repository/MoimRepository.java index 3bf9c66a..43865d32 100644 --- a/module-domain/src/main/java/com/mile/moim/repository/MoimRepository.java +++ b/module-domain/src/main/java/com/mile/moim/repository/MoimRepository.java @@ -13,6 +13,10 @@ import java.util.Optional; public interface MoimRepository extends JpaRepository { + + @Query("select m from Moim m join fetch m.owner where m.id = :id") + Optional findById(final long id); + Boolean existsByNormalizedName(final String normalizedName); @Query("SELECT m FROM Post p JOIN p.topic t JOIN t.moim m WHERE m.isPublic = true AND p.isTemporary = false AND p.createdAt BETWEEN :startOfWeek AND :endOfWeek GROUP BY m ORDER BY COUNT(p)")