feat(scraping): implémenter le health check de tous les scrapers
- Commande CheckAllScrapersHealth + handler avec ports dédiés - Value Object ContentSourceHealthCheckData - Resource API Platform et State Processor - Adapters InMemory et tests unitaires + fonctionnels
This commit is contained in:
parent
795cbeccc3
commit
01474c264b
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Scraping\Infrastructure\ApiPlatform\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Domain\Scraping\Infrastructure\ApiPlatform\State\Processor\CheckAllScrapersHealthStateProcessor;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'Scraping',
|
||||
operations: [
|
||||
new Post(
|
||||
uriTemplate: '/scraping/check-all-health',
|
||||
processor: CheckAllScrapersHealthStateProcessor::class,
|
||||
output: false,
|
||||
status: 202,
|
||||
description: 'Déclenche le test de santé de tous les scrapers configurés avec testSlug',
|
||||
),
|
||||
]
|
||||
)]
|
||||
class CheckAllScrapersHealthResource
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Scraping\Infrastructure\ApiPlatform\State\Processor;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProcessorInterface;
|
||||
use App\Domain\Scraping\Application\Command\CheckAllScrapersHealth;
|
||||
use App\Domain\Scraping\Application\CommandHandler\CheckAllScrapersHealthHandler;
|
||||
|
||||
readonly class CheckAllScrapersHealthStateProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
private CheckAllScrapersHealthHandler $handler,
|
||||
) {
|
||||
}
|
||||
|
||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): null
|
||||
{
|
||||
$this->handler->handle(new CheckAllScrapersHealth());
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user