class EcoNewsDtoMapper extends AbstractConverter<EcoNews, EcoNewsDto> {

    @Override
    public EcoNewsDto convert(EcoNews ecoNews) {
        User author = ecoNews.getAuthor();
        EcoNewsAuthorDto ecoNewsAuthorDto = new EcoNewsAuthorDto(author.getId(),
            author.getName());

        return new EcoNewsDto(ecoNews.getCreationDate(), ecoNews.getImagePath(),
            ecoNews.getId(), ecoNews.getTitle(), ecoNews.getText(), ecoNews.getSource(),
            ecoNewsAuthorDto,
            ecoNews.getTags()
                .stream()
                .map(Tag::getName)
                .collect(Collectors.toList()));
    }

}