fix(channel-donation): 채널 후원 조회 기간을 월 경계 기준으로 통일한다

This commit is contained in:
2026-02-27 13:57:04 +09:00
parent 44a67f1f0f
commit a85bc67f7a
6 changed files with 165 additions and 25 deletions

View File

@@ -395,6 +395,7 @@ class ExplorerService(
limit = 4
)
// 채널 후원
val channelDonationList = if (isCreator && !isBlock) {
channelDonationService.getChannelDonationListForProfile(
creatorId = creatorId,

View File

@@ -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

View File

@@ -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!!,