6 Commits

Author SHA1 Message Date
xbgmsharp
a1e8827479 Release 0.5.1 2023-11-27 22:50:31 +01:00
xbgmsharp
d837dc57fb Update test version 2023-11-27 22:50:21 +01:00
xbgmsharp
90e8b24321 Update openapi documentation 2023-11-27 22:50:04 +01:00
xbgmsharp
a1ccfd5f7c Update frontend pre-release 0.8.0-beta2 2023-11-27 22:49:15 +01:00
xbgmsharp
6ecb345758 Fix Enforce public vessel name to be alphanumeric.
Fix typo for pushover notification
2023-11-27 22:44:26 +01:00
xbgmsharp
0709bc83c4 Fix api.monitoring_view, api.stays_view, api.stay_view and api.moorages_stays_view 2023-11-27 22:43:27 +01:00
6 changed files with 31 additions and 23 deletions

View File

@@ -59,7 +59,7 @@ COMMENT ON VIEW
api.logs_view
IS 'Logs web view';
-- Initial try of MATERIALIZED VIEW
-- Initial try of MATERIALIZED VIEW - does not support RLS
CREATE MATERIALIZED VIEW api.logs_mat_view AS
SELECT id,
name as "name",
@@ -106,7 +106,6 @@ COMMENT ON VIEW
IS 'Log web view';
-- Stays web view
-- TODO group by month
DROP VIEW IF EXISTS api.stays_view;
CREATE OR REPLACE VIEW api.stays_view WITH (security_invoker=true,security_barrier=true) AS
SELECT s.id,
@@ -125,10 +124,11 @@ CREATE OR REPLACE VIEW api.stays_view WITH (security_invoker=true,security_barri
_to._from_moorage_id AS "departed_to_moorage_id",
_to._from AS "departed_to_moorage_name",
s.notes AS "notes"
FROM api.stays s, api.stays_at sa, api.moorages m
LEFT JOIN api.logbook As _from ON _from._from_moorage_id = m.id
LEFT JOIN api.logbook AS _to ON _to._to_moorage_id = m.id
FROM api.stays_at sa, api.moorages m, api.stays s
LEFT JOIN api.logbook AS _from ON _from._from_time = s.departed
LEFT JOIN api.logbook AS _to ON _to._to_time = s.arrived
WHERE s.departed IS NOT NULL
AND _from._to_moorage_id IS NOT NULL
AND s.name IS NOT NULL
AND s.stay_code = sa.stay_code
AND s.moorage_id = m.id
@@ -156,10 +156,11 @@ CREATE OR REPLACE VIEW api.stay_view WITH (security_invoker=true,security_barrie
_to._from_moorage_id AS "departed_to_moorage_id",
_to._from AS "departed_to_moorage_name",
s.notes AS "notes"
FROM api.stays s, api.stays_at sa, api.moorages m
LEFT JOIN api.logbook As _from ON _from._from_moorage_id = m.id
LEFT JOIN api.logbook AS _to ON _to._to_moorage_id = m.id
FROM api.stays_at sa, api.moorages m, api.stays s
LEFT JOIN api.logbook AS _from ON _from._from_time = s.departed
LEFT JOIN api.logbook AS _to ON _to._to_time = s.arrived
WHERE s.departed IS NOT NULL
AND _from._to_moorage_id IS NOT NULL
AND s.name IS NOT NULL
AND s.stay_code = sa.stay_code
AND s.moorage_id = m.id
@@ -235,14 +236,20 @@ COMMENT ON VIEW
IS 'Moorage details web view';
DROP VIEW IF EXISTS api.moorages_stays_view;
CREATE OR REPLACE VIEW api.moorages_stays_view WITH (security_invoker=true,security_barrier=true) AS -- TODO
CREATE OR REPLACE VIEW api.moorages_stays_view WITH (security_invoker=true,security_barrier=true) AS
SELECT
_to.id AS _to_id,_to._to_time,
_from.id AS _from_id,_from._from_time,
m.stay_code,m.stay_duration,m.id
FROM api.moorages m
LEFT JOIN api.logbook As _from ON _from._from_moorage_id = m.id
LEFT JOIN api.logbook AS _to ON _to._to_moorage_id = m.id
_to.id AS _to_id,
_to._to_time,
_from.id AS _from_id,
_from._from_time,
s.stay_code,s.duration,m.id
FROM api.stays_at sa, api.moorages m, api.stays s
LEFT JOIN api.logbook AS _from ON _from._from_time = s.departed
LEFT JOIN api.logbook AS _to ON _to._to_time = s.arrived
WHERE s.departed IS NOT NULL
AND s.name IS NOT NULL
AND s.stay_code = sa.stay_code
AND s.moorage_id = m.id
ORDER BY _to._to_time DESC;
-- Description
COMMENT ON VIEW
@@ -371,13 +378,14 @@ CREATE VIEW api.monitoring_view WITH (security_invoker=true,security_barrier=tru
metrics-> 'environment.inside.temperature' AS insideTemperature,
metrics-> 'environment.outside.temperature' AS outsideTemperature,
metrics-> 'environment.wind.speedOverGround' AS windSpeedOverGround,
metrics-> 'environment.wind.directionGround' AS windDirectionGround,
metrics-> 'environment.wind.directionTrue' AS windDirectionTrue,
metrics-> 'environment.inside.relativeHumidity' AS insideHumidity,
metrics-> 'environment.outside.relativeHumidity' AS outsideHumidity,
metrics-> 'environment.outside.pressure' AS outsidePressure,
metrics-> 'environment.inside.pressure' AS insidePressure,
metrics-> 'electrical.batteries.House.capacity.stateOfCharge' AS batteryCharge,
metrics-> 'electrical.batteries.House.voltage' AS batteryVoltage,
metrics-> 'environment.depth.belowTransducer' AS depth,
jsonb_build_object(
'type', 'Feature',
'geometry', ST_AsGeoJSON(st_makepoint(longitude,latitude))::jsonb,

View File

@@ -76,7 +76,7 @@ INSERT INTO public.email_templates VALUES
('monitor_online',
'Boat went Online',
E'__BOAT__ just came online\nFind more details at __APP_URL__/boats\n',
'Boat went Offline',
'Boat went Online',
E'__BOAT__ just came online\nFind more details at __APP_URL__/boats\n'),
('new_badge',
'New Badge!',
@@ -193,7 +193,7 @@ $new_vessel_entry$ language plpgsql;
create function new_vessel_public_fn() returns trigger as $new_vessel_public$
begin
-- Update user settings with a public vessel name
perform api.update_user_preferences_fn('{public_vessel}', NEW.name);
perform api.update_user_preferences_fn('{public_vessel}', regexp_replace(NEW.name, '\W+', '', 'g'));
return NEW;
END;
$new_vessel_public$ language plpgsql;

View File

@@ -1 +1 @@
0.5.0
0.5.1

File diff suppressed because one or more lines are too long

View File

@@ -615,10 +615,10 @@ reverse_geocode_py_fn | {"name": "Spain", "country_code": "es"}
Test geoip reverse_geoip_py_fn
-[ RECORD 1 ]----------------------------------------------------------------------------------------------------------------------------------------------
versions_fn | {"api_version" : "0.5.0", "sys_version" : "PostgreSQL 15.5", "timescaledb" : "2.12.2", "postgis" : "3.4.0", "postgrest" : "PostgREST 11.2.2"}
versions_fn | {"api_version" : "0.5.1", "sys_version" : "PostgreSQL 15.5", "timescaledb" : "2.12.2", "postgis" : "3.4.0", "postgrest" : "PostgREST 11.2.2"}
-[ RECORD 1 ]-----------------
api_version | 0.5.0
api_version | 0.5.1
sys_version | PostgreSQL 15.5
timescaledb | 2.12.2
postgis | 3.4.0