From c3ab87136614f04b2a95f103ab1cb6956e11ed31 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 9 Dec 2022 17:59:59 +0100 Subject: [PATCH] Exposed new short URLs list filtering params --- .../Persistence/ShortUrlsCountFiltering.php | 4 ++++ .../Persistence/ShortUrlsListFiltering.php | 15 ++++++++++++++- .../Adapter/ShortUrlRepositoryAdapterTest.php | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/module/Core/src/ShortUrl/Persistence/ShortUrlsCountFiltering.php b/module/Core/src/ShortUrl/Persistence/ShortUrlsCountFiltering.php index 2d1b1f21..906adc63 100644 --- a/module/Core/src/ShortUrl/Persistence/ShortUrlsCountFiltering.php +++ b/module/Core/src/ShortUrl/Persistence/ShortUrlsCountFiltering.php @@ -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, ); diff --git a/module/Core/src/ShortUrl/Persistence/ShortUrlsListFiltering.php b/module/Core/src/ShortUrl/Persistence/ShortUrlsListFiltering.php index dd7eb0aa..ed8793be 100644 --- a/module/Core/src/ShortUrl/Persistence/ShortUrlsListFiltering.php +++ b/module/Core/src/ShortUrl/Persistence/ShortUrlsListFiltering.php @@ -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, ); diff --git a/module/Core/test/ShortUrl/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php b/module/Core/test/ShortUrl/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php index aa8efbd5..e271448c 100644 --- a/module/Core/test/ShortUrl/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php +++ b/module/Core/test/ShortUrl/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php @@ -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(); }