캐릭터 챗봇 #338

Merged
klaus merged 119 commits from test into main 2025-09-10 06:08:47 +00:00
1 changed files with 2 additions and 8 deletions
Showing only changes of commit 15d0952de8 - Show all commits

View File

@ -61,15 +61,9 @@ class ChatQuotaService(
} }
} }
@Transactional(readOnly = true) @Transactional
fun getStatus(memberId: Long): QuotaStatus { fun getStatus(memberId: Long): QuotaStatus {
val q = repo.findByMemberId(memberId) ?: return QuotaStatus( return applyRefillOnEnterAndGetStatus(memberId)
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)
} }
@Transactional @Transactional