Files
Mangarr/src/Domain/Setting/Application/Response/ContentSourceResponse.php
ext.jeremy.guillot@maxicoffee.domains 734dea569c feat(setting): étendre ContentSource avec champs de test et domain model
- Ajouter testSlug, testChapterNumber, baseUrl sur ContentSource (entité, domain model, migration)
- Exposer ces champs dans les Resources, Processors, Providers et Mapper
- Mettre à jour store Pinia, repository API et composants Vue (form, card, liste)
2026-03-16 00:09:19 +01:00

45 lines
1.6 KiB
PHP

<?php
namespace App\Domain\Setting\Application\Response;
use App\Domain\Setting\Domain\Model\ContentSource;
readonly class ContentSourceResponse
{
public function __construct(
public int $id,
public string $baseUrl,
public string $chapterUrlFormat,
public string $scrapingType,
public ?string $imageSelector,
public ?string $nextPageSelector,
public ?string $chapterSelector,
public string $cleanBaseUrl,
public ?string $testSlug = null,
public ?float $testChapterNumber = null,
public string $healthStatus = 'unknown',
public ?\DateTimeImmutable $healthLastTestedAt = null,
public ?string $healthLastError = null,
) {
}
public static function fromDomain(ContentSource $contentSource): self
{
return new self(
id: $contentSource->getId(),
baseUrl: $contentSource->getBaseUrl(),
chapterUrlFormat: $contentSource->getChapterUrlFormat(),
scrapingType: $contentSource->getScrapingType(),
imageSelector: $contentSource->getImageSelector(),
nextPageSelector: $contentSource->getNextPageSelector(),
chapterSelector: $contentSource->getChapterSelector(),
cleanBaseUrl: $contentSource->getCleanBaseUrl(),
testSlug: $contentSource->getTestSlug(),
testChapterNumber: $contentSource->getTestChapterNumber(),
healthStatus: $contentSource->getHealthStatus(),
healthLastTestedAt: $contentSource->getHealthLastTestedAt(),
healthLastError: $contentSource->getHealthLastError(),
);
}
}