diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..efef4c72e47ed279a6033fead73e208291c888ca --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. +Changes before version 3.1.0 is not included + +## [3.1.0] - 2024-05-15 + +### Added + +- A column **_use_in_public_api_** in samplingpoints table that controls whether the samplingpoint should be exposed when using the [public api](https://git.nilu.no/raven/raven-public-api/) +- A [sql file](sql/use_in_public_api.sql) required to be run in order for this version to work diff --git a/README.md b/README.md index 1ff9138dd50e1e44bb45eb7f2421deb373e3725e..1379f4bb45f8f3f13572e78addf4965f989701d6 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ git clone https://git.nilu.no/raven/raven-administration 2. Install Postgis (https://postgis.net/install/) and enable it on the database `CREATE EXTENSION postgis;` 3. Run the `sql\schema.sql` script 4. Run the `sql\data.sql` script +5. Run the `sql\pre_aggregates.sql` script +6. Run the `sql\use_in_public_api.sql` script ## Set environment varables diff --git a/api/endpoints/management/samplingpoints/models.py b/api/endpoints/management/samplingpoints/models.py index 1e30e89d19e1e5520b57b8d08d920f805bc6892d..8f11aa20264d46962dd3b8c4d2d9a564b962c2d6 100644 --- a/api/endpoints/management/samplingpoints/models.py +++ b/api/endpoints/management/samplingpoints/models.py @@ -16,6 +16,7 @@ class SamplingPointsModel(BaseModel): begin_position: str mobile: bool private: bool + use_in_public_api: bool main_emission_sources: Optional[str] = None traffic_emissions: Optional[str] = None diff --git a/api/endpoints/management/samplingpoints/routes.py b/api/endpoints/management/samplingpoints/routes.py index 8b491afdaaf241905d10dedab6414522f7600ad6..319787402e69130dd59a57e80cccb86b69df355f 100644 --- a/api/endpoints/management/samplingpoints/routes.py +++ b/api/endpoints/management/samplingpoints/routes.py @@ -46,7 +46,8 @@ def samplingpoints(): sc.label as station_classification, p.notation as pollutant, cn.notation as concentration, - tm.label as timestep,tm.label,cn.notation + tm.label as timestep,tm.label,cn.notation, + sp.use_in_public_api FROM sampling_points sp,eea_mediavalues mv, eea_measurementregimevalues mr, eea_assessmenttypes ast, eea_stationclassifications sc, stations st, eea_pollutants p, eea_concentrations cn, eea_times tm, sampling_point_access spa @@ -96,7 +97,8 @@ def samplingpoints_update(): pollutant=%(pollutant_id)s, concentration=%(concentration_id)s, timestep=%(timestep_id)s, - private=%(private)s + private=%(private)s, + use_in_public_api=%(use_in_public_api)s WHERE id = %(id)s """ @@ -137,7 +139,8 @@ def samplingpoints_insert(): pollutant, concentration, timestep, - private + private, + use_in_public_api ) VALUES ( %(id)s, @@ -160,7 +163,8 @@ def samplingpoints_insert(): %(pollutant_id)s, %(concentration_id)s, %(timestep_id)s, - %(private)s + %(private)s, + %(use_in_public_api)s ) """ diff --git a/api/endpoints/version/routes.py b/api/endpoints/version/routes.py index c41ec44bd133b9eacebbf357eb761035019214c8..fd519a81d4f913f73f5f80209b738cc472118d51 100644 --- a/api/endpoints/version/routes.py +++ b/api/endpoints/version/routes.py @@ -3,7 +3,7 @@ from flask_jwt_extended import create_access_token import requests version_endpoint = Blueprint('version', __name__) -current_version = "3.0.19" +current_version = "3.1.0" @version_endpoint.route('/api/version', methods=['GET']) diff --git a/client/src/views/management/samplingpoints/pageOptions.js b/client/src/views/management/samplingpoints/pageOptions.js index 4f68828fc6abee8daa595102e9094c91816049b1..33abc6fd6e694526b7fa6412005f1e032c967de1 100644 --- a/client/src/views/management/samplingpoints/pageOptions.js +++ b/client/src/views/management/samplingpoints/pageOptions.js @@ -17,6 +17,7 @@ const pageOptions = (lookups) => ({ { type: "checkbox", label: "Mobile", prop: "mobile", required: true, default: false, enableInEdit: true, showInGrid: false }, { type: "checkbox", label: "Private", prop: "private", required: true, default: false, enableInEdit: true, showInGrid: true }, + { type: "checkbox", label: "Public api", prop: "use_in_public_api", required: true, default: false, enableInEdit: true, showInGrid: true }, // OPTIONAL { type: "text", label: "Logger id", prop: "logger_id", placeholder: "str: Logger id for push functionality", required: false, default: null, enableInEdit: true, showInGrid: false }, diff --git a/sql/use_in_public_api.sql b/sql/use_in_public_api.sql new file mode 100644 index 0000000000000000000000000000000000000000..1e69d87933bb58d48c75c21e25b03e8258b5b7d0 --- /dev/null +++ b/sql/use_in_public_api.sql @@ -0,0 +1,2 @@ +alter table sampling_points + add use_in_public_api boolean default False not null; \ No newline at end of file