diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt index 69964fd..80b6ccf 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt @@ -61,15 +61,9 @@ class ChatQuotaService( } } - @Transactional(readOnly = true) + @Transactional fun getStatus(memberId: Long): QuotaStatus { - val q = repo.findByMemberId(memberId) ?: return QuotaStatus( - totalRemaining = FREE_BUCKET, - nextRechargeAtEpochMillis = null - ) - val total = q.remainingFree + q.remainingPaid - val epoch = q.nextRechargeAt?.atZone(ZoneId.systemDefault())?.toInstant()?.toEpochMilli() - return QuotaStatus(totalRemaining = total, nextRechargeAtEpochMillis = epoch) + return applyRefillOnEnterAndGetStatus(memberId) } @Transactional