Skip to content

Commit

Permalink
Merge pull request #7 from itk-dev/feature/#687_add_sort
Browse files Browse the repository at this point in the history
Feature/#687 add sort
  • Loading branch information
turegjorup authored Apr 29, 2024
2 parents f8b80e8 + 0b9d613 commit 4cabbe7
Show file tree
Hide file tree
Showing 18 changed files with 238 additions and 172 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ See [keep a changelog] for information about writing changes to this log.
- Added pagination and match filter
- Added date filters
- Ensure combined filters are possible
- -Added api endpoinst for occurrences, location, tags, vocabularies and filters
- Added api endpoinst for occurrences, location, tags, vocabularies and filters
- Sort response

[keep a changelog]: https://keepachangelog.com/en/1.1.0/
[unreleased]: https://github.com/itk-dev/event-database-imports/compare/main...develop
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# itk-version: 3.2.0
version: "3.8"

services:
phpfpm:
environment:
Expand Down
34 changes: 16 additions & 18 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
phpfpm:
networks:
Expand All @@ -20,20 +18,20 @@ services:
- RABBITMQ_DEFAULT_PASS=password
- RABBITMQ_ERLANG_COOKIE='d53f319cd7376f8f840aaf9889f315ab

elasticsearch:
image: elasticsearch:8.10.2
networks:
- app
- frontend
ports:
- "9200"
deploy:
resources:
limits:
memory: 1096M
reservations:
memory: 1096M
environment:
- discovery.type=single-node
- xpack.security.enabled=false
# elasticsearch:
# image: elasticsearch:8.10.2
# networks:
# - app
# - frontend
# ports:
# - "9200"
# deploy:
# resources:
# limits:
# memory: 1096M
# reservations:
# memory: 1096M
# environment:
# - discovery.type=single-node
# - xpack.security.enabled=false

1 change: 0 additions & 1 deletion docker-compose.redirect.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# itk-version: 3.2.0
version: "3.8"

services:
nginx:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.server.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# itk-version: 3.2.0
version: "3.8"

networks:
frontend:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# itk-version: 3.2.0
version: "3.8"

networks:
frontend:
Expand Down
18 changes: 0 additions & 18 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,11 @@
<MissingTemplateParam>
<code>ProviderInterface</code>
</MissingTemplateParam>
<PossiblyNullArgument>
<code><![CDATA[$hit['name']]]></code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess>
<code><![CDATA[$hit['name']]]></code>
<code><![CDATA[$this->index->get(IndexNames::Tags->value, $uriVariables['name'], 'name')['_source']]]></code>
</PossiblyNullArrayAccess>
</file>
<file src="src/Api/State/VocabularyRepresentationProvider.php">
<MissingTemplateParam>
<code>ProviderInterface</code>
</MissingTemplateParam>
<PossiblyNullArgument>
<code><![CDATA[$hit['description']]]></code>
<code><![CDATA[$hit['name']]]></code>
<code><![CDATA[$hit['tags']]]></code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess>
<code><![CDATA[$hit['description']]]></code>
<code><![CDATA[$hit['name']]]></code>
<code><![CDATA[$hit['tags']]]></code>
<code><![CDATA[$this->index->get(IndexNames::Vocabularies->value, $uriVariables['name'], 'name')['_source']]]></code>
</PossiblyNullArrayAccess>
</file>
<file src="src/Command/FixturesLoadCommand.php">
<UndefinedDocblockClass>
Expand Down
38 changes: 28 additions & 10 deletions public/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ paths:
responses:
200:
description: 'Single daily occurrence'
404:
description: 'Resource not found'
summary: 'Retrieves a DailyOccurrence resource.'
description: 'Retrieves a DailyOccurrence resource.'
parameters:
Expand Down Expand Up @@ -365,6 +367,8 @@ paths:
responses:
200:
description: 'Single event'
404:
description: 'Resource not found'
summary: 'Retrieves a Event resource.'
description: 'Retrieves a Event resource.'
parameters:
Expand Down Expand Up @@ -466,6 +470,8 @@ paths:
responses:
200:
description: 'Single location'
404:
description: 'Resource not found'
summary: 'Get single location based on identifier'
description: 'Retrieves a Location resource.'
parameters:
Expand Down Expand Up @@ -653,7 +659,9 @@ paths:
responses:
200:
description: 'Single occurrence'
summary: 'Retrieves a Occurrence resource.'
404:
description: 'Resource not found'
summary: 'Get single occurrence based on identifier'
description: 'Retrieves a Occurrence resource.'
parameters:
-
Expand Down Expand Up @@ -742,6 +750,8 @@ paths:
responses:
200:
description: 'Single organization'
404:
description: 'Resource not found'
summary: 'Get single organization based on identifier'
description: 'Retrieves a Organization resource.'
parameters:
Expand Down Expand Up @@ -823,19 +833,21 @@ paths:
allowReserved: false
deprecated: false
parameters: []
'/api/v2/tags/{name}':
'/api/v2/tags/{slug}':
get:
operationId: api_tags_name_get
operationId: api_tags_slug_get
tags:
- Tag
responses:
200:
description: 'Single tag'
description: 'Get single tag'
404:
description: 'Resource not found'
summary: 'Get single tag'
description: 'Retrieves a Tag resource.'
parameters:
-
name: name
name: slug
in: path
description: ''
required: true
Expand Down Expand Up @@ -912,19 +924,21 @@ paths:
allowReserved: false
deprecated: false
parameters: []
'/api/v2/vocabularies/{name}':
'/api/v2/vocabularies/{slug}':
get:
operationId: api_vocabularies_name_get
operationId: api_vocabularies_slug_get
tags:
- Vocabulary
responses:
200:
description: 'Single vocabulary'
summary: 'Get a vocabulary based on name'
description: 'Get single vocabulary'
404:
description: 'Resource not found'
summary: 'Get a vocabulary based on slug'
description: 'Retrieves a Vocabulary resource.'
parameters:
-
name: name
name: slug
in: path
description: ''
required: true
Expand Down Expand Up @@ -1107,6 +1121,8 @@ components:
- '@vocab'
- hydra
additionalProperties: true
slug:
type: string
name:
type: string
Vocabulary.jsonld:
Expand Down Expand Up @@ -1137,6 +1153,8 @@ components:
- '@vocab'
- hydra
additionalProperties: true
slug:
type: string
name:
type: string
description:
Expand Down
31 changes: 17 additions & 14 deletions src/Api/Dto/DailyOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Parameter;
use ApiPlatform\OpenApi\Model\Response;
use App\Api\Filter\ElasticSearch\BooleanFilter;
use App\Api\Filter\ElasticSearch\DateFilter;
use App\Api\Filter\ElasticSearch\EventTagFilter;
Expand All @@ -17,23 +20,23 @@
#[ApiResource(
operations: [
new Get(
openapiContext: [
'parameters' => [
[
'name' => 'id',
'in' => 'path',
'required' => true,
'schema' => [
openapi: new Operation(
responses: [
'200' => new Response(
description: 'Single daily occurrence'
),
],
parameters: [
new Parameter(
name: 'id',
in: 'path',
required: true,
schema: [
'type' => 'integer',
],
],
],
'responses' => [
'200' => [
'description' => 'Single daily occurrence',
],
),
],
],
),
output: DailyOccurrenceRepresentationProvider::class,
provider: DailyOccurrenceRepresentationProvider::class,
),
Expand Down
33 changes: 18 additions & 15 deletions src/Api/Dto/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Parameter;
use ApiPlatform\OpenApi\Model\Response;
use App\Api\Filter\ElasticSearch\BooleanFilter;
use App\Api\Filter\ElasticSearch\DateFilter;
use App\Api\Filter\ElasticSearch\EventTagFilter;
Expand All @@ -17,23 +20,23 @@
#[ApiResource(
operations: [
new Get(
openapiContext: [
'parameters' => [
[
'name' => 'id',
'in' => 'path',
'required' => true,
'schema' => [
openapi: new Operation(
responses: [
'200' => new Response(
description: 'Single event'
),
],
parameters: [
new Parameter(
name: 'id',
in: 'path',
required: true,
schema: [
'type' => 'integer',
],
],
],
'responses' => [
'200' => [
'description' => 'Single event',
],
],
],
),
]
),
output: EventRepresentationProvider::class,
provider: EventRepresentationProvider::class,
),
Expand Down
35 changes: 19 additions & 16 deletions src/Api/Dto/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Parameter;
use ApiPlatform\OpenApi\Model\Response;
use App\Api\Filter\ElasticSearch\MatchFilter;
use App\Api\State\LocationRepresentationProvider;

#[ApiResource(
operations: [
new Get(
openapiContext: [
'summary' => 'Get single location based on identifier',
'parameters' => [
[
'name' => 'id',
'in' => 'path',
'required' => true,
'schema' => [
openapi: new Operation(
responses: [
'200' => new Response(
description: 'Single location'
),
],
summary: 'Get single location based on identifier',
parameters: [
new Parameter(
name: 'id',
in: 'path',
required: true,
schema: [
'type' => 'integer',
],
],
],
'responses' => [
'200' => [
'description' => 'Single location',
],
],
],
),
]
),
output: LocationRepresentationProvider::class,
provider: LocationRepresentationProvider::class,
),
Expand Down
Loading

0 comments on commit 4cabbe7

Please sign in to comment.