mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Add makefile to help with development setup, change part_ids in bulk import jobs to junction table and implement filtering based on bulk import jobs status and its associated parts' statuses.
This commit is contained in:
parent
9b4d5e9c27
commit
cc9d50a8fe
22 changed files with 1357 additions and 120 deletions
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Controller;
|
||||
|
||||
use App\Entity\BulkInfoProviderImportJob;
|
||||
use App\Entity\BulkInfoProviderImportJobPart;
|
||||
use App\Entity\BulkImportJobStatus;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Supplier;
|
||||
|
|
@ -104,7 +105,6 @@ class BulkInfoProviderImportController extends AbstractController
|
|||
|
||||
// Create and save the job
|
||||
$job = new BulkInfoProviderImportJob();
|
||||
$job->setPartIds(array_map(fn($part) => $part->getId(), $parts));
|
||||
$job->setFieldMappings($fieldMappings);
|
||||
$job->setPrefetchDetails($prefetchDetails);
|
||||
$user = $this->getUser();
|
||||
|
|
@ -113,6 +113,12 @@ class BulkInfoProviderImportController extends AbstractController
|
|||
}
|
||||
$job->setCreatedBy($user);
|
||||
|
||||
// Create job parts for each part
|
||||
foreach ($parts as $part) {
|
||||
$jobPart = new BulkInfoProviderImportJobPart($job, $part);
|
||||
$job->addJobPart($jobPart);
|
||||
}
|
||||
|
||||
$this->entityManager->persist($job);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
|
@ -179,7 +185,7 @@ class BulkInfoProviderImportController extends AbstractController
|
|||
|
||||
// Convert DTOs to result format with metadata
|
||||
$partResult['search_results'] = array_map(
|
||||
function($dto) use ($dtoMetadata) {
|
||||
function ($dto) use ($dtoMetadata) {
|
||||
$dtoKey = $dto->provider_key . '|' . $dto->provider_id;
|
||||
$metadata = $dtoMetadata[$dtoKey] ?? [];
|
||||
return [
|
||||
|
|
@ -372,8 +378,7 @@ class BulkInfoProviderImportController extends AbstractController
|
|||
}
|
||||
|
||||
// Get the parts and deserialize search results
|
||||
$partRepository = $this->entityManager->getRepository(Part::class);
|
||||
$parts = $partRepository->getElementsFromIDArray($job->getPartIds());
|
||||
$parts = $job->getJobParts()->map(fn($jobPart) => $jobPart->getPart())->toArray();
|
||||
$searchResults = $this->deserializeSearchResults($job->getSearchResults(), $parts);
|
||||
|
||||
return $this->render('info_providers/bulk_import/step2.html.twig', [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue