class AisConsentUsageService {

    @Transactional
    public Map<String, Integer> getUsageCounterMap(ConsentEntity consent) {
        return aisConsentUsageRepository.findReadByConsentAndUsageDate(consent, LocalDate.now())
                   .stream()
                   .collect(Collectors.toMap(AisConsentUsage::getRequestUri,
                                             u -> Math.max(consent.getFrequencyPerDay() - u.getUsage(), 0)));
    }

}