diff --git a/.commitlintrc.js b/.commitlintrc.mjs similarity index 97% rename from .commitlintrc.js rename to .commitlintrc.mjs index 4e715ad5d..ae4ffd168 100644 --- a/.commitlintrc.js +++ b/.commitlintrc.mjs @@ -1,4 +1,4 @@ -module.exports = { +export default { extends: [ '@commitlint/config-conventional' ], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b9d8c8e1..728662c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: linkedevents-ci +name: CI on: push: @@ -6,117 +6,13 @@ on: pull_request: branches: [main] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: -env: - SECRET_KEY: topsecret123 - POSTGRES_DB: test_linkedevents - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - DATABASE_URL: "postgis://postgres:postgres@localhost/test_linkedevents" - FIELD_ENCRYPTION_KEYS: c87a6669a1ded2834f1dfd0830d86ef6cdd20372ac83e8c7c23feffe87e6a051 - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python: [3.9] - services: - postgres: - image: postgis/postgis:14-3.2-alpine - env: - # Note: not redundant, parent env is not applied to service - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: test_linkedevents - ports: - - 5432:5432 - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - # Required by Sonar - fetch-depth: 0 - - - name: Update apt - run: sudo apt-get update - - - name: psycopg2 prerequisites - run: sudo apt-get install libpq-dev - - - name: System requirements for Django - run: sudo apt-get install gdal-bin gettext postgresql-client - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - cache: pip - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt -r requirements-dev.txt - - - name: Configure sysctl limits - run: | - sudo swapoff -a - sudo sysctl -w vm.swappiness=1 - sudo sysctl -w fs.file-max=262144 - sudo sysctl -w vm.max_map_count=262144 - - - name: Check migrations - run: | - python manage.py makemigrations --dry-run --check - - - name: Apply migrations - run: | - python manage.py migrate - - - name: Compile translations - run: | - django-admin compilemessages - - - name: Check OpenAPI schema - run: | - python manage.py spectacular --lang en --validate --fail-on-warn --api-version v1 - - - name: Run Ruff lint - uses: astral-sh/ruff-action@v1 - with: - version: 0.7.1 - - - name: Run Ruff format check - uses: astral-sh/ruff-action@v1 - with: - version: 0.7.1 - args: "format --check" - - - name: Check commitlint - uses: wagoid/commitlint-github-action@0d749a1a91d4770e983a7b8f83d4a3f0e7e0874e # v5.4.4 - - # With pytest-cov use: --cov=. - # Some errors, skipping --doctest-modules for now - - name: Run tests - uses: liskin/gh-problem-matcher-wrap@v2 - with: - linters: pytest - run: pytest -ra -vvv --cov=. - - - name: Codecov - uses: codecov/codecov-action@v3 - - # Without this workaround Sonar reports a warning about an incorrect source path - - name: Override coverage report source path for Sonar - run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + common: + uses: tuomas777/.github/.github/workflows/ci-django-api.yml@reusable_workflow_precommit + secrets: inherit + with: + python-version: 3.9 + postgres-major-version: 14 + use-postgis: true + extra-commands: | + python manage.py spectacular --lang en --validate --fail-on-warn --api-version v1 diff --git a/audit_log/models.py b/audit_log/models.py index d5f08bc53..7616f97d2 100644 --- a/audit_log/models.py +++ b/audit_log/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ class AuditLogEntry(models.Model): diff --git a/helevents/templates/rest_framework/keyword_list.html b/helevents/templates/rest_framework/keyword_list.html index 6ee56a84c..97026b123 100644 --- a/helevents/templates/rest_framework/keyword_list.html +++ b/helevents/templates/rest_framework/keyword_list.html @@ -1,13 +1,13 @@
Here, categories for events are listed. Events in each category can be found at the +
Here, categories for events are listed. Events in each category can be found at the
event
endpoint using the query parameter keyword
. The common keywords
used in all events originate from the general Finnish ontology (yso),
hence the format yso:p4354
. Default ordering is decreasing order by the number of events found.
The most common event categories are listed in the two keyword sets - helsinki:topics and - helsinki:audiences, +
The most common event categories are listed in the two keyword sets + helsinki:topics and + helsinki:audiences, which list the YSO keywords that are present in most events to specify event main topic and audience.
While the previous search is looking for the keywords containg exact matches of the search string, +
While the previous search is looking for the keywords containg exact matches of the search string,
free_text
retrieves keywords on the basis of similarity. Results are
sorted by similarity.
Example:
@@ -31,14 +31,14 @@To show only the keywords which are used in the upcoming events supply the +
To show only the keywords which are used in the upcoming events supply the
has_upcoming_events
query parameter.
For example:
keyword/?has_upcoming_events=True
-
+
By default, only those keywords which have listed events are +
By default, only those keywords which have listed events are
displayed. You may display keywords with zero n_events
with the
query parameter show_all_keywords
.
For example:
@@ -46,7 +46,7 @@By default, deprecated keywords are not displayed. You may also display deprecated keywords with the +
By default, deprecated keywords are not displayed. You may also display deprecated keywords with the
query parameter show_deprecated
.
For example:
keyword/?show_deprecated=True
diff --git a/helevents/templates/rest_framework/keyword_set_list.html b/helevents/templates/rest_framework/keyword_set_list.html
index 582d53b02..34b1b4055 100644
--- a/helevents/templates/rest_framework/keyword_set_list.html
+++ b/helevents/templates/rest_framework/keyword_set_list.html
@@ -2,8 +2,8 @@
Here, the preferred sets of common keywords are listed.
-We recommend using the 20 piece keyword set helsinki:topics
for general event grouping and
- helsinki:audiences
for sorting by target group. These sets are used by the City of Helsinki in
+
We recommend using the 20 piece keyword set helsinki:topics
for general event grouping and
+ helsinki:audiences
for sorting by target group. These sets are used by the City of Helsinki in
categorizing the majority of events in the API.
ar
are supported.
Events organized in or translated to a specific language can be found at the event
endpoint using the query parameter language
.
To find out languages which can or cannot be used as service language in a registration, +
To find out languages which can or cannot be used as service language in a registration,
use the query parameterservice_language
.
Example:
event/?service_language=true
diff --git a/helevents/templates/rest_framework/organization_list.html b/helevents/templates/rest_framework/organization_list.html
index b0972c951..c24ac219a 100644
--- a/helevents/templates/rest_framework/organization_list.html
+++ b/helevents/templates/rest_framework/organization_list.html
@@ -5,14 +5,14 @@ event
endpoint using the query parameter publisher
.
To find parent organization and all its ancestors for the given organization id use the query +
To find parent organization and all its ancestors for the given organization id use the query
parameter child
.
Example:
organization/?child=ahjo:100
To find all suborganizations and their descendants for the given organization id use the query +
To find all suborganizations and their descendants for the given organization id use the query
parameter parent
.
Example:
organization/?parent=ahjo:100
diff --git a/helevents/templates/rest_framework/registration_list.html b/helevents/templates/rest_framework/registration_list.html
index fc583dda4..6de517e3c 100644
--- a/helevents/templates/rest_framework/registration_list.html
+++ b/helevents/templates/rest_framework/registration_list.html
@@ -16,12 +16,12 @@ Example:
registration/?event_type=course
-
+
In the default case, event, keywords, locations, and other fields that refer to separate resources are only displayed as simple references.
If you want to include the complete data from related resources in
- the current response, use the keyword include
.
include
.
Please note, however,
that including all the resources inlined in *every* event will result in a huge number
of duplicate data in the json, making the json very slow to generate and process and causing
diff --git a/helevents/templates/rest_framework/root.html b/helevents/templates/rest_framework/root.html
index 1e99b5f17..806c8ec27 100644
--- a/helevents/templates/rest_framework/root.html
+++ b/helevents/templates/rest_framework/root.html
@@ -1,14 +1,14 @@
This Linked events API contains event data from the City of Helsinki, including
- Helsinki Marketing,
- Helsinki Cultural Centres
+ This Linked events API contains event data from the City of Helsinki, including
+ Helsinki Marketing,
+ Helsinki Cultural Centres
and the Helmet metropolitan area public libraries. The API is developed by the
- City of Helsinki Open Software Development team, who also provide
+ The API is developed by the
+ City of Helsinki Open Software Development team, who also provide
the complete API specifications.
- The location information is linked to the City of Helsinki registry of service units which contains
- e.g. information about accessibility. In the API, you can search data by date or location as well
+ The location information is linked to the City of Helsinki registry of service units which contains
+ e.g. information about accessibility. In the API, you can search data by date or location as well
as bounding box. However, some images may only be used for marketing the specific event and may not be used outside this context.
+ However, some images may only be used for marketing the specific event and may not be used outside this context.
These images are marked as event_only in the API. The event_only license is as follows: Helsingin kaupungilla on kuviin kaikki oikeudet. Mikäli rajapinnassa jaettavan kuvan tietojen
- kohdassa license on merkintä event_only, saa kuvaa käyttää ainoastaan kuvan
- tapahtumaa käsittelevään tiedotukseen ja viestintään. Kuvien käyttäminen tähän tarkoitukseen
- on käyttäjälle ilmaista. Kuvan käyttö tai siirto muihin tarkoituksiin on kielletty. Kuvia
+ Helsingin kaupungilla on kuviin kaikki oikeudet. Mikäli rajapinnassa jaettavan kuvan tietojen
+ kohdassa license on merkintä event_only, saa kuvaa käyttää ainoastaan kuvan
+ tapahtumaa käsittelevään tiedotukseen ja viestintään. Kuvien käyttäminen tähän tarkoitukseen
+ on käyttäjälle ilmaista. Kuvan käyttö tai siirto muihin tarkoituksiin on kielletty. Kuvia
käytettäessä on ehdottomasti mainittava kuvien lähde ja kuvaaja. Helsingfors stad äger alla rättigheter till bilderna. Om beteckningen event_only
- förekommer under license i uppgifterna för en bild som delas i gränssnittet, får
- bilden användas endast för informering eller kommunikation som gäller evenemanget på bilden.
- Att använda bilderna för det här ändamålet är gratis. Att använda eller flytta bilden för
- andra ändamål är förbjudet. Vid användning av bilder ska källan och fotografen absolut
+ Helsingfors stad äger alla rättigheter till bilderna. Om beteckningen event_only
+ förekommer under license i uppgifterna för en bild som delas i gränssnittet, får
+ bilden användas endast för informering eller kommunikation som gäller evenemanget på bilden.
+ Att använda bilderna för det här ändamålet är gratis. Att använda eller flytta bilden för
+ andra ändamål är förbjudet. Vid användning av bilder ska källan och fotografen absolut
nämnas. The City of Helsinki reserves all rights to the images. If the data at license of an
- image shared in the interface contains the text event_only, then the image can only
- be used for information and communications connected to the event depicted in the image.
- The images can be used free of charge for this purpose. To use or move the image for other
- purposes is forbidden. The source and photographer must absolutely be mentioned when using
+ The City of Helsinki reserves all rights to the images. If the data at license of an
+ image shared in the interface contains the text event_only, then the image can only
+ be used for information and communications connected to the event depicted in the image.
+ The images can be used free of charge for this purpose. To use or move the image for other
+ purposes is forbidden. The source and photographer must absolutely be mentioned when using
an image. This is the supposedly intelligent Elasticsearch Finnish full-text search for both events and places.
- The results are sorted by relevance score shown in the In the default case, both events and places are returned. The type of each resource is returned in the
- In the default case, both events and places are returned. The type of each resource is returned in the
+ When searching for events only ( When searching for events only ( When searching for events only ( When searching for events only ( For fast autocomplete substring match in the resource name, use the For fast autocomplete substring match in the resource name, use the To find out signups that contain a specific string in name, email, extra_info, membership_number or phone_number fields,
+ To find out signups that contain a specific string in name, email, extra_info, membership_number or phone_number fields,
use the query parameter Example:Data license
@@ -16,27 +16,27 @@ Data license
FI |
SV |
EN.
- FI
- SV
- EN
- Using the search endpoint
score
field. The search parameter
+ The results are sorted by relevance score shown in the score
field. The search parameter
is ?q=
.
Specifying resource type
- resource_type
field. You may use the parameter type
to ask for only
+ resource_type
field. You may use the parameter type
to ask for only
event
or place
.
-
+
Future events with time decay
- ?type=event
), by default only future events are returned,
- with a decay function applied so that next events get a higher relevance score. This means that events
+ ?type=event
), by default only future events are returned,
+ with a decay function applied so that next events get a higher relevance score. This means that events
in the near future are returned first:search/?type=event&q=sibelius
Events with time filtering
- ?type=event
), you may also search for events in
- the specified time range using start
or end
or both. In this case,
- relevance score is calculated only based on Finnish tokenization of the search string, with no time
+ ?type=event
), you may also search for events in
+ the specified time range using start
or end
or both. In this case,
+ relevance score is calculated only based on Finnish tokenization of the search string, with no time
preference:search/?type=event&q=sibelius&start=2017-01-01
Autocomplete
- ?input=
parameter
- instead. When searching for events only (?type=event
), by default only future events
- are returned, with a decay function applied so that next events get a higher relevance score.
+ ?input=
parameter
+ instead. When searching for events only (?type=event
), by default only future events
+ are returned, with a decay function applied so that next events get a higher relevance score.
May be combined with start
and end
.
diff --git a/helevents/templates/rest_framework/signup_list.html b/helevents/templates/rest_framework/signup_list.html
index 11f909807..2c5473f53 100644
--- a/helevents/templates/rest_framework/signup_list.html
+++ b/helevents/templates/rest_framework/signup_list.html
@@ -12,7 +12,7 @@ search/?type=place&input=sibe
Registration
Signup text
- text
.
diff --git a/pipelines/linkedevents-api-review.yml b/pipelines/linkedevents-api-review.yml
index debe5211b..1e5781455 100644
--- a/pipelines/linkedevents-api-review.yml
+++ b/pipelines/linkedevents-api-review.yml
@@ -8,11 +8,11 @@
trigger: none
# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
-# opened with one of the specified target branches, or when updates are made to
+# opened with one of the specified target branches, or when updates are made to
# such a pull request.
#
-# GitHub creates a new ref when a pull request is created. The ref points to a
-# merge commit, which is the merged code between the source and target branches
+# GitHub creates a new ref when a pull request is created. The ref points to a
+# merge commit, which is the merged code between the source and target branches
# of the pull request.
#
# Opt out of pull request validation
diff --git a/registrations/templates/_open_registration_button.html b/registrations/templates/_open_registration_button.html
index a287eb1d5..8d57f0bdf 100644
--- a/registrations/templates/_open_registration_button.html
+++ b/registrations/templates/_open_registration_button.html
@@ -7,4 +7,4 @@
-signup/?text=shostakovich