diff --git a/db/dbinfo/publicreport.report_location.bob.go b/db/dbinfo/publicreport.report_location.bob.go index dce9982b..f61aa376 100644 --- a/db/dbinfo/publicreport.report_location.bob.go +++ b/db/dbinfo/publicreport.report_location.bob.go @@ -31,8 +31,8 @@ var PublicreportReportLocations = Table[ Generated: false, AutoIncr: false, }, - Address: column{ - Name: "address", + AddressRaw: column{ + Name: "address_raw", DBType: "text", Default: "NULL", Comment: "", @@ -82,18 +82,18 @@ var PublicreportReportLocations = Table[ } type publicreportReportLocationColumns struct { - ID column - TableName column - Address column - Created column - Location column - PublicID column - Status column + ID column + TableName column + AddressRaw column + Created column + Location column + PublicID column + Status column } func (c publicreportReportLocationColumns) AsSlice() []column { return []column{ - c.ID, c.TableName, c.Address, c.Created, c.Location, c.PublicID, c.Status, + c.ID, c.TableName, c.AddressRaw, c.Created, c.Location, c.PublicID, c.Status, } } diff --git a/db/migrations/00099_publicreport_location_water.sql b/db/migrations/00099_publicreport_location_water.sql new file mode 100644 index 00000000..0e274fa5 --- /dev/null +++ b/db/migrations/00099_publicreport_location_water.sql @@ -0,0 +1,60 @@ +-- +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_raw, + created, + location, + public_id, + status +FROM ( + SELECT + 'nuisance' AS table_name, + address_raw, + created, + location, + public_id, + status + FROM publicreport.nuisance + UNION + SELECT + 'water' AS table_name, + address_raw, + created, + location, + public_id, + 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_raw, + created, + location, + public_id, + status +FROM ( + SELECT + 'nuisance' AS table_name, + address_raw, + created, + location, + public_id, + status + FROM publicreport.nuisance + UNION + SELECT + 'pool' AS table_name, + address_raw, + created, + location, + public_id, + status + FROM publicreport.water +) AS combined_data; diff --git a/db/models/publicreport.report_location.bob.go b/db/models/publicreport.report_location.bob.go index 04348b85..a2512c1f 100644 --- a/db/models/publicreport.report_location.bob.go +++ b/db/models/publicreport.report_location.bob.go @@ -16,13 +16,13 @@ import ( // PublicreportReportLocation is an object representing the database table. type PublicreportReportLocation struct { - ID null.Val[int64] `db:"id" ` - TableName null.Val[string] `db:"table_name" ` - Address null.Val[string] `db:"address" ` - Created null.Val[time.Time] `db:"created" ` - Location null.Val[string] `db:"location" ` - PublicID null.Val[string] `db:"public_id" ` - Status null.Val[enums.PublicreportReportstatustype] `db:"status" ` + ID null.Val[int64] `db:"id" ` + TableName null.Val[string] `db:"table_name" ` + AddressRaw null.Val[string] `db:"address_raw" ` + Created null.Val[time.Time] `db:"created" ` + Location null.Val[string] `db:"location" ` + PublicID null.Val[string] `db:"public_id" ` + Status null.Val[enums.PublicreportReportstatustype] `db:"status" ` } // PublicreportReportLocationSlice is an alias for a slice of pointers to PublicreportReportLocation. @@ -38,12 +38,12 @@ type PublicreportReportLocationsQuery = *psql.ViewQuery[*PublicreportReportLocat func buildPublicreportReportLocationColumns(alias string) publicreportReportLocationColumns { return publicreportReportLocationColumns{ ColumnsExpr: expr.NewColumnsExpr( - "id", "table_name", "address", "created", "location", "public_id", "status", + "id", "table_name", "address_raw", "created", "location", "public_id", "status", ).WithParent("publicreport.report_location"), tableAlias: alias, ID: psql.Quote(alias, "id"), TableName: psql.Quote(alias, "table_name"), - Address: psql.Quote(alias, "address"), + AddressRaw: psql.Quote(alias, "address_raw"), Created: psql.Quote(alias, "created"), Location: psql.Quote(alias, "location"), PublicID: psql.Quote(alias, "public_id"), @@ -56,7 +56,7 @@ type publicreportReportLocationColumns struct { tableAlias string ID psql.Expression TableName psql.Expression - Address psql.Expression + AddressRaw psql.Expression Created psql.Expression Location psql.Expression PublicID psql.Expression @@ -96,13 +96,13 @@ func (o PublicreportReportLocationSlice) AfterQueryHook(ctx context.Context, exe } type publicreportReportLocationWhere[Q psql.Filterable] struct { - ID psql.WhereNullMod[Q, int64] - TableName psql.WhereNullMod[Q, string] - Address psql.WhereNullMod[Q, string] - Created psql.WhereNullMod[Q, time.Time] - Location psql.WhereNullMod[Q, string] - PublicID psql.WhereNullMod[Q, string] - Status psql.WhereNullMod[Q, enums.PublicreportReportstatustype] + ID psql.WhereNullMod[Q, int64] + TableName psql.WhereNullMod[Q, string] + AddressRaw psql.WhereNullMod[Q, string] + Created psql.WhereNullMod[Q, time.Time] + Location psql.WhereNullMod[Q, string] + PublicID psql.WhereNullMod[Q, string] + Status psql.WhereNullMod[Q, enums.PublicreportReportstatustype] } func (publicreportReportLocationWhere[Q]) AliasedAs(alias string) publicreportReportLocationWhere[Q] { @@ -111,12 +111,12 @@ func (publicreportReportLocationWhere[Q]) AliasedAs(alias string) publicreportRe func buildPublicreportReportLocationWhere[Q psql.Filterable](cols publicreportReportLocationColumns) publicreportReportLocationWhere[Q] { return publicreportReportLocationWhere[Q]{ - ID: psql.WhereNull[Q, int64](cols.ID), - TableName: psql.WhereNull[Q, string](cols.TableName), - Address: psql.WhereNull[Q, string](cols.Address), - Created: psql.WhereNull[Q, time.Time](cols.Created), - Location: psql.WhereNull[Q, string](cols.Location), - PublicID: psql.WhereNull[Q, string](cols.PublicID), - Status: psql.WhereNull[Q, enums.PublicreportReportstatustype](cols.Status), + ID: psql.WhereNull[Q, int64](cols.ID), + TableName: psql.WhereNull[Q, string](cols.TableName), + AddressRaw: psql.WhereNull[Q, string](cols.AddressRaw), + Created: psql.WhereNull[Q, time.Time](cols.Created), + Location: psql.WhereNull[Q, string](cols.Location), + PublicID: psql.WhereNull[Q, string](cols.PublicID), + Status: psql.WhereNull[Q, enums.PublicreportReportstatustype](cols.Status), } } diff --git a/html/static/js/map-locator-ro.js b/html/static/js/map-locator-ro.js index 21a2a9db..6380f1d7 100644 --- a/html/static/js/map-locator-ro.js +++ b/html/static/js/map-locator-ro.js @@ -47,7 +47,6 @@ class MapLocatorReadOnly extends HTMLElement { }) .setLngLat(marker.coordinates) .addTo(this._map); - this.dispatchEvent(markerDraggedEvent); this.dispatchEvent( new CustomEvent("load", { bubbles: true, diff --git a/html/template/rmo/status-by-id.html b/html/template/rmo/status-by-id.html index 10c8b72d..03b148b7 100644 --- a/html/template/rmo/status-by-id.html +++ b/html/template/rmo/status-by-id.html @@ -2,8 +2,12 @@ {{ define "title" }}Status of report {{ .Report.ID|publicReportID }}{{ end }} {{ define "extraheader" }} + - + - + {{ end }} {{ define "content" }} {{ if (eq .District nil) }} @@ -133,7 +119,12 @@ document.addEventListener("DOMContentLoaded", onLoad);