Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
III-2021: Add workflowStatus url parameter on offer search endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bertramakers committed Apr 4, 2017
1 parent ab7b14d commit c050a1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/OfferSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use CultuurNet\UDB3\Search\Offer\AudienceType;
use CultuurNet\UDB3\Search\Offer\OfferSearchParameters;
use CultuurNet\UDB3\Search\Offer\OfferSearchServiceInterface;
use CultuurNet\UDB3\Search\Offer\WorkflowStatus;
use CultuurNet\UDB3\Search\QueryStringFactoryInterface;
use CultuurNet\UDB3\Search\Region\RegionId;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down Expand Up @@ -119,6 +120,12 @@ public function search(Request $request)
$parameters = $parameters->withLanguages(...$languages);
}

if (!empty($request->query->get('workflowStatus'))) {
$parameters = $parameters->withWorkflowStatus(
new WorkflowStatus($request->query->get('workflowStatus'))
);
}

if (!empty($request->query->get('regionId'))) {
$parameters = $parameters->withRegion(
new RegionId($request->query->get('regionId')),
Expand Down
5 changes: 5 additions & 0 deletions tests/OfferSearchControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use CultuurNet\UDB3\Search\Offer\AudienceType;
use CultuurNet\UDB3\Search\Offer\OfferSearchParameters;
use CultuurNet\UDB3\Search\Offer\OfferSearchServiceInterface;
use CultuurNet\UDB3\Search\Offer\WorkflowStatus;
use CultuurNet\UDB3\Search\PagedResultSet;
use CultuurNet\UDB3\Search\Region\RegionId;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -81,6 +82,7 @@ public function it_returns_a_paged_collection_of_search_results_based_on_request
'start' => 30,
'limit' => 10,
'q' => 'dag van de fiets',
'workflowStatus' => 'DRAFT',
'regionId' => 'gem-leuven',
'coordinates' => '-40,70',
'distance' => '30km',
Expand All @@ -102,6 +104,9 @@ public function it_returns_a_paged_collection_of_search_results_based_on_request
->withQueryString(
new MockQueryString('dag van de fiets')
)
->withWorkflowStatus(
new WorkflowStatus('DRAFT')
)
->withRegion(
new RegionId('gem-leuven'),
$this->regionIndexName,
Expand Down

0 comments on commit c050a1f

Please sign in to comment.