class EcoNewsServiceImpl implements EcoNewsService {

    @Cacheable(value = CacheConstants.NEWEST_ECO_NEWS_CACHE_NAME)
    @Override
    public List<EcoNewsDto> getThreeLastEcoNews() {
        List<EcoNews> ecoNewsList = ecoNewsRepo.getThreeLastEcoNews();

        if (ecoNewsList.isEmpty()) {
            throw new NotFoundException(ErrorMessage.ECO_NEWS_NOT_FOUND);
        }

        return ecoNewsList
                .stream()
                .map(ecoNews -> modelMapper.map(ecoNews, EcoNewsDto.class))
                .collect(Collectors.toList());
    }

}