Exposed new short URLs list filtering params

This commit is contained in:
Alejandro Celaya 2022-12-09 17:59:59 +01:00
parent 42a5296f93
commit c3ab871366
3 changed files with 19 additions and 2 deletions

View file

@ -21,6 +21,8 @@ class ShortUrlsCountFiltering
public readonly array $tags = [],
public readonly ?TagsMode $tagsMode = null,
public readonly ?DateRange $dateRange = null,
public readonly bool $excludeMaxVisitsReached = false,
public readonly bool $excludePastValidUntil = false,
public readonly ?ApiKey $apiKey = null,
?string $defaultDomain = null,
) {
@ -37,6 +39,8 @@ class ShortUrlsCountFiltering
$params->tags,
$params->tagsMode,
$params->dateRange,
$params->excludeMaxVisitsReached,
$params->excludePastValidUntil,
$apiKey,
$defaultDomain,
);

View file

@ -20,10 +20,21 @@ class ShortUrlsListFiltering extends ShortUrlsCountFiltering
array $tags = [],
?TagsMode $tagsMode = null,
?DateRange $dateRange = null,
bool $excludeMaxVisitsReached = false,
bool $excludePastValidUntil = false,
?ApiKey $apiKey = null,
?string $defaultDomain = null,
) {
parent::__construct($searchTerm, $tags, $tagsMode, $dateRange, $apiKey, $defaultDomain);
parent::__construct(
$searchTerm,
$tags,
$tagsMode,
$dateRange,
$excludeMaxVisitsReached,
$excludePastValidUntil,
$apiKey,
$defaultDomain,
);
}
public static function fromLimitsAndParams(
@ -41,6 +52,8 @@ class ShortUrlsListFiltering extends ShortUrlsCountFiltering
$params->tags,
$params->tagsMode,
$params->dateRange,
$params->excludePastValidUntil,
$params->excludePastValidUntil,
$apiKey,
$defaultDomain,
);

View file

@ -74,7 +74,7 @@ class ShortUrlRepositoryAdapterTest extends TestCase
$dateRange = $params->dateRange;
$this->repo->expects($this->once())->method('countList')->with(
new ShortUrlsCountFiltering($searchTerm, $tags, TagsMode::ANY, $dateRange, $apiKey),
new ShortUrlsCountFiltering($searchTerm, $tags, TagsMode::ANY, $dateRange, apiKey: $apiKey),
);
$adapter->getNbResults();
}