Skip to content

Commit

Permalink
fix :: add last week filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jombidev committed Aug 14, 2024
1 parent e65ede0 commit fbfb981
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.molohala.grow.core.member.domain.exception.AccessDeniedException
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.time.LocalDateTime

@Service
@Transactional(readOnly = true)
Expand Down Expand Up @@ -109,13 +110,8 @@ class CommunityService(
?: likeCachedRepository.clear(it.communityId).let { null }
}
.filter { community ->
blocks.firstOrNull { it.blockedUserId == community.writerId } == null
}
.map {
CommunityListRes(
it,
queryCommentRepository.findRecentComment(communityId = it.communityId, userId = member.id!!)
)
blocks.firstOrNull { it.blockedUserId == community.writerId } == null && // block filter
community.createdAt.isAfter(LocalDateTime.now().minusDays(7)) // last week filter
}
.let {
if (it.size >= count) {
Expand All @@ -124,5 +120,11 @@ class CommunityService(
it
}
}
.map {
CommunityListRes(
it,
queryCommentRepository.findRecentComment(communityId = it.communityId, userId = member.id)
)
}
}
}

0 comments on commit fbfb981

Please sign in to comment.