class TppOperationInfoService {

    public List<OperationInfo> getOperationsByTypeAndTppId(OperationType operationType) {
        String tppId = validateAndGetTppId();
        List<OperationInfoEntity> infos = Optional.ofNullable(operationType)
                                              .map(o -> infoRepository.findAllByTppIdAndOperationTypeOrderByCreatedDesc(tppId, OperationTypeEntity.valueOf(o.name())))
                                              .orElseGet(() -> infoRepository.findAllByTppIdOrderByCreatedDesc(tppId));
        return infoMapper.toOperationInfos(infos);
    }

}