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