Initial creation of endpoint to send messages to public reporters
This commit is contained in:
parent
9707e8793b
commit
cc95c38ab5
12 changed files with 240 additions and 20 deletions
90
db/migrations/00109_publicreport_reporter_contact.sql
Normal file
90
db/migrations/00109_publicreport_reporter_contact.sql
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
-- +goose Up
|
||||
DROP VIEW publicreport.report_location;
|
||||
CREATE VIEW publicreport.report_location AS
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY table_name, public_id) AS id,
|
||||
table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
location_latitude,
|
||||
location_longitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
reporter_email,
|
||||
reporter_phone,
|
||||
status
|
||||
FROM (
|
||||
SELECT
|
||||
'nuisance' AS table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
ST_X(location) AS location_longitude,
|
||||
ST_Y(location) AS location_latitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
reporter_email,
|
||||
reporter_phone,
|
||||
status
|
||||
FROM publicreport.nuisance
|
||||
UNION
|
||||
SELECT
|
||||
'water' AS table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
ST_X(location) AS location_longitude,
|
||||
ST_Y(location) AS location_latitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
reporter_email,
|
||||
reporter_phone,
|
||||
status
|
||||
FROM publicreport.water
|
||||
) AS combined_data;
|
||||
-- +goose Down
|
||||
DROP VIEW publicreport.report_location;
|
||||
CREATE VIEW publicreport.report_location AS
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY table_name, public_id) AS id,
|
||||
table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
location_latitude,
|
||||
location_longitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
status
|
||||
FROM (
|
||||
SELECT
|
||||
'nuisance' AS table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
ST_X(location) AS location_longitude,
|
||||
ST_Y(location) AS location_latitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
status
|
||||
FROM publicreport.nuisance
|
||||
UNION
|
||||
SELECT
|
||||
'water' AS table_name,
|
||||
address_id,
|
||||
address_raw,
|
||||
created,
|
||||
location,
|
||||
ST_X(location) AS location_longitude,
|
||||
ST_Y(location) AS location_latitude,
|
||||
organization_id,
|
||||
public_id,
|
||||
status
|
||||
FROM publicreport.water
|
||||
) AS combined_data;
|
||||
Loading…
Add table
Add a link
Reference in a new issue