fix(channel-donation): 채널 후원 조회 기간을 월 경계 기준으로 통일한다
This commit is contained in:
@@ -395,6 +395,7 @@ class ExplorerService(
|
||||
limit = 4
|
||||
)
|
||||
|
||||
// 채널 후원
|
||||
val channelDonationList = if (isCreator && !isBlock) {
|
||||
channelDonationService.getChannelDonationListForProfile(
|
||||
creatorId = creatorId,
|
||||
|
||||
@@ -17,14 +17,16 @@ interface ChannelDonationMessageQueryRepository {
|
||||
isCreator: Boolean,
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
startDateTime: LocalDateTime
|
||||
startDateTime: LocalDateTime,
|
||||
endDateTime: LocalDateTime
|
||||
): List<ChannelDonationMessage>
|
||||
|
||||
fun getChannelDonationMessageTotalCount(
|
||||
creatorId: Long,
|
||||
memberId: Long,
|
||||
isCreator: Boolean,
|
||||
startDateTime: LocalDateTime
|
||||
startDateTime: LocalDateTime,
|
||||
endDateTime: LocalDateTime
|
||||
): Int
|
||||
}
|
||||
|
||||
@@ -37,13 +39,15 @@ class ChannelDonationMessageQueryRepositoryImpl(
|
||||
isCreator: Boolean,
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
startDateTime: LocalDateTime
|
||||
startDateTime: LocalDateTime,
|
||||
endDateTime: LocalDateTime
|
||||
): List<ChannelDonationMessage> {
|
||||
val where = whereCondition(
|
||||
creatorId = creatorId,
|
||||
memberId = memberId,
|
||||
isCreator = isCreator,
|
||||
startDateTime = startDateTime
|
||||
startDateTime = startDateTime,
|
||||
endDateTime = endDateTime
|
||||
)
|
||||
|
||||
return queryFactory
|
||||
@@ -62,13 +66,15 @@ class ChannelDonationMessageQueryRepositoryImpl(
|
||||
creatorId: Long,
|
||||
memberId: Long,
|
||||
isCreator: Boolean,
|
||||
startDateTime: LocalDateTime
|
||||
startDateTime: LocalDateTime,
|
||||
endDateTime: LocalDateTime
|
||||
): Int {
|
||||
val where = whereCondition(
|
||||
creatorId = creatorId,
|
||||
memberId = memberId,
|
||||
isCreator = isCreator,
|
||||
startDateTime = startDateTime
|
||||
startDateTime = startDateTime,
|
||||
endDateTime = endDateTime
|
||||
)
|
||||
|
||||
return queryFactory
|
||||
@@ -83,9 +89,11 @@ class ChannelDonationMessageQueryRepositoryImpl(
|
||||
creatorId: Long,
|
||||
memberId: Long,
|
||||
isCreator: Boolean,
|
||||
startDateTime: LocalDateTime
|
||||
startDateTime: LocalDateTime,
|
||||
endDateTime: LocalDateTime
|
||||
) = channelDonationMessage.creator.id.eq(creatorId)
|
||||
.and(channelDonationMessage.createdAt.goe(startDateTime))
|
||||
.and(channelDonationMessage.createdAt.lt(endDateTime))
|
||||
.let {
|
||||
if (isCreator) {
|
||||
it
|
||||
|
||||
@@ -11,8 +11,9 @@ import kr.co.vividnext.sodalive.member.MemberRole
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
import java.time.LocalDateTime
|
||||
import java.time.LocalDate
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.temporal.TemporalAdjusters
|
||||
|
||||
@Service
|
||||
class ChannelDonationService(
|
||||
@@ -61,14 +62,18 @@ class ChannelDonationService(
|
||||
memberRepository.findCreatorByIdOrNull(creatorId)
|
||||
?: throw SodaException(messageKey = "member.validation.creator_not_found")
|
||||
|
||||
val startDateTime = LocalDateTime.now().minusMonths(1)
|
||||
val startDateTime = LocalDate.now()
|
||||
.with(TemporalAdjusters.firstDayOfMonth())
|
||||
.atStartOfDay()
|
||||
val endDateTime = startDateTime.plusMonths(1)
|
||||
val isCreator = member.role == MemberRole.CREATOR && creatorId == member.id
|
||||
|
||||
val totalCount = channelDonationMessageRepository.getChannelDonationMessageTotalCount(
|
||||
creatorId = creatorId,
|
||||
memberId = member.id!!,
|
||||
isCreator = isCreator,
|
||||
startDateTime = startDateTime
|
||||
startDateTime = startDateTime,
|
||||
endDateTime = endDateTime
|
||||
)
|
||||
|
||||
val items = channelDonationMessageRepository.getChannelDonationMessageList(
|
||||
@@ -77,7 +82,8 @@ class ChannelDonationService(
|
||||
isCreator = isCreator,
|
||||
offset = offset,
|
||||
limit = limit,
|
||||
startDateTime = startDateTime
|
||||
startDateTime = startDateTime,
|
||||
endDateTime = endDateTime
|
||||
).map {
|
||||
GetChannelDonationListItem(
|
||||
id = it.id!!,
|
||||
|
||||
Reference in New Issue
Block a user