mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 14:19:33 +00:00
Refactor bulk info provider: replace complex arrays with DTOs
- Add BulkSearchResponseDTO, FieldMappingDTO for type safety - Use composition instead of inheritance in BulkSearchResultDTO - Remove unnecessary BulkSearchRequestDTO - Fix N+1 queries and API error handling - Fix Add Mapping button functionality
This commit is contained in:
parent
8998b006e0
commit
2c195d9767
15 changed files with 838 additions and 195 deletions
|
|
@ -132,6 +132,15 @@ class MouserProvider implements InfoProviderInterface
|
|||
],
|
||||
]);
|
||||
|
||||
// Check for API errors before processing response
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
'Mouser API returned HTTP %d: %s',
|
||||
$response->getStatusCode(),
|
||||
$response->getContent(false)
|
||||
));
|
||||
}
|
||||
|
||||
return $this->responseToDTOArray($response);
|
||||
}
|
||||
|
||||
|
|
@ -169,6 +178,16 @@ class MouserProvider implements InfoProviderInterface
|
|||
]
|
||||
],
|
||||
]);
|
||||
|
||||
// Check for API errors before processing response
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
'Mouser API returned HTTP %d: %s',
|
||||
$response->getStatusCode(),
|
||||
$response->getContent(false)
|
||||
));
|
||||
}
|
||||
|
||||
$tmp = $this->responseToDTOArray($response);
|
||||
|
||||
//Ensure that we have exactly one result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue