class EcoNewsCommentServiceImpl implements EcoNewsCommentService {

    @Override
    public void deleteById(Long id, User user) {
        EcoNewsComment comment = ecoNewsCommentRepo.findById(id)
            .orElseThrow(() -> new NotFoundException(ErrorMessage.COMMENT_NOT_FOUND_EXCEPTION));

        if (user.getRole() != ROLE.ROLE_ADMIN && user.getRole() != ROLE.ROLE_MODERATOR
            && !user.getId().equals(comment.getUser().getId())) {
            throw new BadRequestException(ErrorMessage.USER_HAS_NO_PERMISSION);
        }
        comment.setDeleted(true);
        ecoNewsCommentRepo.save(comment);
    }

}