added zwg support

This commit is contained in:
Prince
2026-06-17 14:43:56 +02:00
parent 0eda74414e
commit 6ccded7fce
2 changed files with 8 additions and 6 deletions

View File

@@ -34,9 +34,9 @@ public class ProviderController {
return ResponseEntity.ok(providerService.getProviderProducts(id.toString())); return ResponseEntity.ok(providerService.getProviderProducts(id.toString()));
} }
@GetMapping("/{id}/products/{productId}") @GetMapping("/{id}/products/{productName}")
public ResponseEntity getProducts(@PathVariable UUID id, @PathVariable UUID productId) { public ResponseEntity getProducts(@PathVariable UUID id, @PathVariable String productName) {
return ResponseEntity.ok(providerService.getProviderProduct(id, productId)); return ResponseEntity.ok(providerService.getProviderProduct(id, productName));
} }
@GetMapping("/client/{clientId}") @GetMapping("/client/{clientId}")

View File

@@ -41,11 +41,13 @@ public class ProviderService {
@Value("${sbz.aggregator.url}") @Value("${sbz.aggregator.url}")
private String aggregatorUrl; private String aggregatorUrl;
public SBZProductDto getProviderProduct(UUID providerId, UUID productId) { public SBZProductDto getProviderProduct(UUID providerId, String productName) {
return getProviderProducts(providerId.toString()).stream() List<SBZProductDto> products = getProviderProducts(providerId.toString());
.filter(product -> product.getUid().equals(productId)) SBZProductDto productResult = products.stream()
.filter(product -> product.getName().equals(productName))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
return productResult;
} }
@Deprecated @Deprecated