Skip to content

Commit f8b80e8

Browse files
authored
Merge pull request #6 from itk-dev/feature/687_tags_fix
Feature/687 api endpoints and filters
2 parents 80c3da9 + f157092 commit f8b80e8

38 files changed

+1964
-169
lines changed

.docker/data/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .docker/data
2+
3+
Please map persistent volumes to this directory on the servers.
4+
5+
If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.
6+
7+
## RabbitMQ example
8+
If you are using RabbitMQ running in a container as a message broker you need to configure a persistent volume for RabbitMQs data directory to avoid losing message on container restarts.
9+
10+
```yaml
11+
# docker-compose.server.override.yml
12+
13+
services:
14+
rabbit:
15+
image: rabbitmq:3.9-management-alpine
16+
hostname: "${COMPOSE_PROJECT_NAME}"
17+
networks:
18+
- app
19+
- frontend
20+
environment:
21+
- "RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}"
22+
- "RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}"
23+
- "RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}"
24+
volumes:
25+
- ".docker/data/rabbitmq:/var/lib/rabbitmq/mnesia/"
26+
```

.docker/nginx.conf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
worker_processes auto;
22

3-
error_log /var/log/nginx/error.log notice;
3+
error_log /dev/stderr notice;
44
pid /tmp/nginx.pid;
55

66
events {
@@ -26,11 +26,9 @@ http {
2626
'$status $body_bytes_sent "$http_referer" '
2727
'"$http_user_agent" "$http_x_forwarded_for"';
2828

29-
access_log /var/log/nginx/access.log main;
29+
access_log /dev/stdout main;
3030

3131
sendfile on;
32-
#tcp_nopush on;
33-
3432
keepalive_timeout 65;
3533

3634
gzip on;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
server {
2+
listen ${NGINX_PORT};
3+
server_name localhost;
4+
5+
root ${NGINX_WEB_ROOT};
6+
7+
location / {
8+
# try to serve file directly, fallback to index.php
9+
try_files $uri /index.php$is_args$args;
10+
}
11+
12+
# Protect files and directories from prying eyes.
13+
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
14+
deny all;
15+
return 404;
16+
}
17+
18+
location ~ ^/index\.php(/|$) {
19+
fastcgi_buffers 16 32k;
20+
fastcgi_buffer_size 64k;
21+
fastcgi_busy_buffers_size 64k;
22+
23+
fastcgi_pass ${NGINX_FPM_SERVICE};
24+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
25+
include fastcgi_params;
26+
27+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
28+
fastcgi_param DOCUMENT_ROOT $realpath_root;
29+
30+
internal;
31+
}
32+
33+
location ~ \.php$ {
34+
return 404;
35+
}
36+
37+
# Send log message to files symlinked to stdout/stderr.
38+
error_log /dev/stderr;
39+
access_log /dev/stdout main;
40+
}

.github/workflows/pr.yaml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
php: [ '8.2' ]
9+
php: [ '8.3' ]
1010
name: Validate composer (${{ matrix.php}})
1111
steps:
12-
- uses: actions/checkout@master
12+
- uses: actions/checkout@v4
1313

1414
- name: Setup PHP, with composer and extensions
1515
uses: shivammathur/setup-php@v2
1616
with:
1717
php-version: ${{ matrix.php}}
18+
extensions: http, ctype, iconv
1819
coverage: none
1920

2021
- name: Get composer cache directory
2122
id: composer-cache
2223
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
2324

2425
- name: Cache dependencies
25-
uses: actions/cache@v2
26+
uses: actions/cache@v4
2627
with:
2728
path: ${{ steps.composer-cache.outputs.dir }}
2829
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
@@ -42,22 +43,23 @@ jobs:
4243
strategy:
4344
fail-fast: false
4445
matrix:
45-
php: [ '8.2' ]
46+
php: [ '8.3' ]
4647
steps:
47-
- uses: actions/checkout@master
48+
- uses: actions/checkout@v4
4849

4950
- name: Setup PHP, with composer and extensions
5051
uses: shivammathur/setup-php@v2
5152
with:
5253
php-version: ${{ matrix.php}}
54+
extensions: http, ctype, iconv
5355
coverage: xdebug
5456

5557
- name: Get composer cache directory
5658
id: composer-cache
5759
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5860

5961
- name: Cache dependencies
60-
uses: actions/cache@v2
62+
uses: actions/cache@v4
6163
with:
6264
path: ${{ steps.composer-cache.outputs.dir }}
6365
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
@@ -80,25 +82,25 @@ jobs:
8082
strategy:
8183
fail-fast: false
8284
matrix:
83-
php: ["8.2"]
85+
php: ["8.3"]
8486
name: PHP Coding Standards Fixer (PHP ${{ matrix.php }})
8587
steps:
8688
- name: Checkout
87-
uses: actions/checkout@v2
89+
uses: actions/checkout@v4
8890

8991
- name: Setup PHP, with composer and extensions
9092
uses: shivammathur/setup-php@v2
9193
with:
9294
php-version: ${{ matrix.php}}
93-
extensions: apcu, ctype, iconv, imagick, json, pdo_sqlsrv, redis, soap, sqlsrv, xmlreader, zip
95+
extensions: http, ctype, iconv
9496
coverage: none
9597

9698
- name: Get composer cache directory
9799
id: composer-cache
98100
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
99101

100102
- name: Cache composer dependencies
101-
uses: actions/cache@v2
103+
uses: actions/cache@v4
102104
with:
103105
path: ${{ steps.composer-cache.outputs.dir }}
104106
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -115,24 +117,24 @@ jobs:
115117
strategy:
116118
fail-fast: false
117119
matrix:
118-
php: ['8.2']
120+
php: ['8.3']
119121
name: Psalm static analysis (${{ matrix.php}})
120122
steps:
121-
- uses: actions/checkout@master
123+
- uses: actions/checkout@v4
122124

123125
- name: Setup PHP, with composer and extensions
124126
uses: shivammathur/setup-php@v2
125127
with:
126128
php-version: ${{ matrix.php}}
127-
extensions: ctype, iconv, imagick, json, redis, soap, xmlreader, zip
129+
extensions: http, ctype, iconv
128130
coverage: none
129131

130132
- name: Get composer cache directory
131133
id: composer-cache
132134
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
133135

134136
- name: Cache dependencies
135-
uses: actions/cache@v2
137+
uses: actions/cache@v4
136138
with:
137139
path: ${{ steps.composer-cache.outputs.dir }}
138140
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
@@ -150,12 +152,12 @@ jobs:
150152
runs-on: ubuntu-latest
151153
steps:
152154
- name: Checkout
153-
uses: actions/checkout@v2
155+
uses: actions/checkout@v4
154156
- name: Get yarn cache directory path
155157
id: yarn-cache-dir-path
156158
run: echo "::set-output name=dir::$(yarn cache dir)"
157159
- name: Cache yarn packages
158-
uses: actions/cache@v2
160+
uses: actions/cache@v4
159161
id: yarn-cache
160162
with:
161163
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -176,26 +178,26 @@ jobs:
176178
strategy:
177179
fail-fast: false
178180
matrix:
179-
php: [ '8.2' ]
181+
php: [ '8.3' ]
180182
steps:
181183
- name: Checkout
182-
uses: actions/checkout@v3
184+
uses: actions/checkout@v4
183185
with:
184186
fetch-depth: 2
185187

186188
- name: Setup PHP, with composer and extensions
187189
uses: shivammathur/setup-php@v2
188190
with:
189191
php-version: ${{ matrix.php}}
190-
extensions: ctype, iconv, imagick, json, redis, soap, xmlreader, zip
192+
extensions: http, ctype, iconv
191193
coverage: none
192194

193195
- name: Get composer cache directory
194196
id: composer-cache
195197
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
196198

197199
- name: Cache dependencies
198-
uses: actions/cache@v3
200+
uses: actions/cache@v4
199201
with:
200202
path: ${{ steps.composer-cache.outputs.dir }}
201203
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -215,7 +217,7 @@ jobs:
215217
name: Changelog should be updated
216218
steps:
217219
- name: Checkout
218-
uses: actions/checkout@v2
220+
uses: actions/checkout@v4
219221
with:
220222
fetch-depth: 2
221223

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ See [keep a changelog] for information about writing changes to this log.
1818
- Added pagination and match filter
1919
- Added date filters
2020
- Ensure combined filters are possible
21+
- -Added api endpoinst for occurrences, location, tags, vocabularies and filters
2122

2223
[keep a changelog]: https://keepachangelog.com/en/1.1.0/
2324
[unreleased]: https://github.com/itk-dev/event-database-imports/compare/main...develop

baseline.xml

Lines changed: 0 additions & 65 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"require": {
99
"php": ">=8.2",
1010
"ext-ctype": "*",
11+
"ext-http": "*",
1112
"ext-iconv": "*",
1213
"api-platform/core": "^3.2",
1314
"doctrine/doctrine-bundle": "^2.11",

composer.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/services.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,34 @@ services:
2929
arguments:
3030
$filterLocator: '@api_platform.filter_locator'
3131

32+
App\Api\State\DailyOccurrenceRepresentationProvider:
33+
arguments:
34+
$filterLocator: '@api_platform.filter_locator'
35+
3236
App\Api\State\EventRepresentationProvider:
3337
arguments:
3438
$filterLocator: '@api_platform.filter_locator'
3539

40+
App\Api\State\LocationRepresentationProvider:
41+
arguments:
42+
$filterLocator: '@api_platform.filter_locator'
43+
44+
App\Api\State\OccurrenceRepresentationProvider:
45+
arguments:
46+
$filterLocator: '@api_platform.filter_locator'
47+
3648
App\Api\State\OrganizationRepresentationProvider:
3749
arguments:
3850
$filterLocator: '@api_platform.filter_locator'
3951

52+
App\Api\State\TagRepresentationProvider:
53+
arguments:
54+
$filterLocator: '@api_platform.filter_locator'
55+
56+
App\Api\State\VocabularyRepresentationProvider:
57+
arguments:
58+
$filterLocator: '@api_platform.filter_locator'
59+
4060
App\Command\FixturesLoadCommand:
4161
arguments:
4262
$appEnv: '%env(string:APP_ENV)%'

0 commit comments

Comments
 (0)