QuotaService

@Service
class QuotaService(quotaRepository: TenantQuotaRepository, tenantRepository: TenantRepository)(source)

Constructors

Link copied to clipboard
constructor(quotaRepository: TenantQuotaRepository, tenantRepository: TenantRepository)

Functions

Link copied to clipboard
@Transactional
fun consumeQuota(tenantId: String, resourceKey: String, cost: Long = 1)

Verifica se pode consumir e incrementa. Se estourar, lança exceção.