findById
Atualizado
public ProductDTO findById(UUID id) {
Product entity = repository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Department not found"));
return new ProductDTO(entity);
}
@GetMapping(value = "/{id}")
public ResponseEntity<ProductDTO> findById(@PathVariable UUID id) {
ProductDTO dto = productService.findById(id);
return ResponseEntity.ok().body(dto);
}
Atualizado