feat: ajout de la gestion des jobs avec création, récupération et filtrage via l'API, incluant des entités et des mappers pour les échecs et les jobs
This commit is contained in:
parent
d7088b14c2
commit
d7ccc1e603
@@ -59,7 +59,7 @@ readonly class MangadexProvider implements MangaProviderInterface
|
||||
try {
|
||||
$attributes = $result['attributes'];
|
||||
$title = $attributes['title']['en'] ?? null;
|
||||
|
||||
|
||||
if (!$title) {
|
||||
return null;
|
||||
}
|
||||
@@ -85,17 +85,19 @@ readonly class MangadexProvider implements MangaProviderInterface
|
||||
}
|
||||
|
||||
return new Manga(
|
||||
new MangaId((string) Uuid::uuid4()),
|
||||
new MangaTitle($title),
|
||||
new MangaSlug($this->slugger->slug($title)->lower()),
|
||||
$attributes['description']['fr'] ?? $attributes['description']['en'] ?? '',
|
||||
$author,
|
||||
$attributes['year'] ?? 0,
|
||||
$genres,
|
||||
$attributes['status'],
|
||||
new ExternalId($result['id']),
|
||||
$imageUrl,
|
||||
null
|
||||
id: new MangaId((string) Uuid::uuid4()),
|
||||
title: new MangaTitle($title),
|
||||
slug: new MangaSlug($this->slugger->slug($title)->lower()),
|
||||
description: $attributes['description']['fr'] ?? $attributes['description']['en'] ?? '',
|
||||
author: $author,
|
||||
publicationYear: $attributes['year'] ?? 0,
|
||||
genres: $genres,
|
||||
status: $attributes['status'],
|
||||
externalId: new ExternalId($result['id']),
|
||||
imageUrl: $imageUrl,
|
||||
rating: null,
|
||||
imageUrls: null,
|
||||
createdAt: new \DateTimeImmutable(),
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
@@ -128,13 +130,13 @@ readonly class MangadexProvider implements MangaProviderInterface
|
||||
{
|
||||
try {
|
||||
$result = $this->client->getManga($externalId->getValue());
|
||||
|
||||
|
||||
if (!isset($result['data'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$manga = $this->createMangaFromResult($result['data']);
|
||||
|
||||
|
||||
if ($manga) {
|
||||
$this->enrichWithRatings([$manga]);
|
||||
}
|
||||
@@ -144,4 +146,4 @@ readonly class MangadexProvider implements MangaProviderInterface
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user