Skip to content

Commit

Permalink
Merge pull request #6 from itk-dev/feature/687_tags_fix
Browse files Browse the repository at this point in the history
Feature/687 api endpoints and filters
  • Loading branch information
turegjorup authored Mar 7, 2024
2 parents 80c3da9 + f157092 commit f8b80e8
Show file tree
Hide file tree
Showing 38 changed files with 1,964 additions and 169 deletions.
26 changes: 26 additions & 0 deletions .docker/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .docker/data

Please map persistent volumes to this directory on the servers.

If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.

## RabbitMQ example
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.

```yaml
# docker-compose.server.override.yml

services:
rabbit:
image: rabbitmq:3.9-management-alpine
hostname: "${COMPOSE_PROJECT_NAME}"
networks:
- app
- frontend
environment:
- "RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}"
- "RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}"
- "RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}"
volumes:
- ".docker/data/rabbitmq:/var/lib/rabbitmq/mnesia/"
```
6 changes: 2 additions & 4 deletions .docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
worker_processes auto;

error_log /var/log/nginx/error.log notice;
error_log /dev/stderr notice;
pid /tmp/nginx.pid;

events {
Expand All @@ -26,11 +26,9 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
access_log /dev/stdout main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
Expand Down
40 changes: 40 additions & 0 deletions .docker/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
server {
listen ${NGINX_PORT};
server_name localhost;

root ${NGINX_WEB_ROOT};

location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}

# Protect files and directories from prying eyes.
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)$ {
deny all;
return 404;
}

location ~ ^/index\.php(/|$) {
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;

fastcgi_pass ${NGINX_FPM_SERVICE};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

internal;
}

location ~ \.php$ {
return 404;
}

# Send log message to files symlinked to stdout/stderr.
error_log /dev/stderr;
access_log /dev/stdout main;
}
44 changes: 23 additions & 21 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.2' ]
php: [ '8.3' ]
name: Validate composer (${{ matrix.php}})
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: http, ctype, iconv
coverage: none

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

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
Expand All @@ -42,22 +43,23 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.2' ]
php: [ '8.3' ]
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: http, ctype, iconv
coverage: xdebug

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

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
Expand All @@ -80,25 +82,25 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.2"]
php: ["8.3"]
name: PHP Coding Standards Fixer (PHP ${{ matrix.php }})
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

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

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

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -115,24 +117,24 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.2']
php: ['8.3']
name: Psalm static analysis (${{ matrix.php}})
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: ctype, iconv, imagick, json, redis, soap, xmlreader, zip
extensions: http, ctype, iconv
coverage: none

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

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency-version }}-
Expand All @@ -150,12 +152,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn packages
uses: actions/cache@v2
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -176,26 +178,26 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.2' ]
php: [ '8.3' ]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: ctype, iconv, imagick, json, redis, soap, xmlreader, zip
extensions: http, ctype, iconv
coverage: none

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

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -215,7 +217,7 @@ jobs:
name: Changelog should be updated
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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

[keep a changelog]: https://keepachangelog.com/en/1.1.0/
[unreleased]: https://github.com/itk-dev/event-database-imports/compare/main...develop
65 changes: 0 additions & 65 deletions baseline.xml

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-http": "*",
"ext-iconv": "*",
"api-platform/core": "^3.2",
"doctrine/doctrine-bundle": "^2.11",
Expand Down
3 changes: 2 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,34 @@ services:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\DailyOccurrenceRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\EventRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\LocationRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\OccurrenceRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\OrganizationRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\TagRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Api\State\VocabularyRepresentationProvider:
arguments:
$filterLocator: '@api_platform.filter_locator'

App\Command\FixturesLoadCommand:
arguments:
$appEnv: '%env(string:APP_ENV)%'
Expand Down
Loading

0 comments on commit f8b80e8

Please sign in to comment.