feat: ajout de la fonctionnalité de monitoring des mangas, incluant l'activation et la désactivation du suivi, la synchronisation des chapitres, et la mise à jour de l'API pour gérer ces nouvelles actions. Création de nouveaux composants Vue pour le rafraîchissement des chapitres et l'affichage des notifications. Intégration de tests unitaires pour valider le bon fonctionnement de ces fonctionnalités.
This commit is contained in:
parent
d9e78b5229
commit
00d63dffeb
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Tests\Domain\Manga\Adapter;
|
||||
|
||||
use App\Domain\Manga\Application\Query\MonitoringCriteria;
|
||||
use App\Domain\Manga\Domain\Contract\Repository\MangaRepositoryInterface;
|
||||
use App\Domain\Manga\Domain\Model\Chapter;
|
||||
use App\Domain\Manga\Domain\Model\Manga;
|
||||
@@ -190,4 +191,27 @@ class InMemoryMangaRepository implements MangaRepositoryInterface
|
||||
fn (Chapter $chapter) => in_array($chapter->getNumber(), $chapterNumbers)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function findByMonitoringCriteria(MonitoringCriteria $criteria): array
|
||||
{
|
||||
return array_filter(
|
||||
array_values($this->mangas),
|
||||
function (Manga $manga) use ($criteria) {
|
||||
// Vérifier si le monitoring est activé selon le critère
|
||||
if ($manga->getMonitoringStatus()->isEnabled() !== $criteria->enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vérifier la date de dernière vérification si spécifiée
|
||||
if ($criteria->lastCheckBefore !== null) {
|
||||
$lastCheck = $manga->getLastMonitoringCheck();
|
||||
if ($lastCheck === null || $lastCheck >= $criteria->lastCheckBefore) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user