팔로우 한 크리에이터의 7일 이내의 커뮤니티 게시물 10개 가져오기 API 추가
This commit is contained in:
		| @@ -6,7 +6,9 @@ import kr.co.vividnext.sodalive.explorer.profile.creatorCommunity.QCreatorCommun | ||||
| import kr.co.vividnext.sodalive.member.QMember.member | ||||
| import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing | ||||
| import org.springframework.data.jpa.repository.JpaRepository | ||||
| import java.time.LocalDate | ||||
| import java.time.LocalDateTime | ||||
| import java.time.LocalTime | ||||
|  | ||||
| interface CreatorCommunityRepository : JpaRepository<CreatorCommunity, Long>, CreatorCommunityQueryRepository | ||||
|  | ||||
| @@ -76,8 +78,10 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact | ||||
|         val creatorCommunity = QCreatorCommunity.creatorCommunity | ||||
|         val latest = QCreatorCommunity.creatorCommunity | ||||
|  | ||||
|         val localDate = LocalDate.now().minusDays(7) | ||||
|         val localTime = LocalTime.of(0, 0) | ||||
|         var where = creatorCommunity.isActive.isTrue | ||||
|             .and(creatorCommunity.createdAt.after(LocalDateTime.now().minusDays(7))) | ||||
|             .and(creatorCommunity.createdAt.after(LocalDateTime.of(localDate, localTime))) | ||||
|  | ||||
|         if (!isAdult) { | ||||
|             where = where.and(creatorCommunity.isAdult.isFalse) | ||||
| @@ -103,8 +107,6 @@ class CreatorCommunityQueryRepositoryImpl(private val queryFactory: JPAQueryFact | ||||
|  | ||||
|         return queryFactory | ||||
|             .selectFrom(creatorCommunity) | ||||
|             .innerJoin(creatorCommunity.member, member) | ||||
|             .innerJoin(member) | ||||
|             .where(where) | ||||
|             .orderBy(creatorCommunity.createdAt.desc()) | ||||
|             .limit(10) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user