feat: finalizing Scraping endpoint

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-10 17:28:49 +01:00
parent 0374ab0e46
commit 073439163b
28 changed files with 447 additions and 86 deletions

View File

@@ -12,23 +12,17 @@ class InMemoryScrapingJobRepository implements ScrapingJobRepositoryInterface
public function save(ScrapingJob $job): void
{
self::$jobs[] = $job;
self::$jobs[$job->getId()] = $job;
}
public function getJobs(): array
{
return self::$jobs;
return array_values(self::$jobs);
}
public function findById(string $id): ?ScrapingJob
{
foreach (self::$jobs as $job) {
if ($job->getId() === $id) {
return $job;
}
}
return null;
return self::$jobs[$id] ?? null;
}
public function findByChapterId(string $chapterId): ?ScrapingJob
@@ -46,4 +40,4 @@ class InMemoryScrapingJobRepository implements ScrapingJobRepositoryInterface
{
self::$jobs = [];
}
}
}