Fix map display on RMO status-by-id page

This involves rebuilding the "publicreport.report_location" view after
making a bunch of changes to making publicreport.water the consistent
name (over pool) throughout RMA tables.
This commit is contained in:
Eli Ribble 2026-03-11 14:59:04 +00:00
parent a7c34ca3b2
commit 5e7c547670
No known key found for this signature in database
8 changed files with 121 additions and 76 deletions

View file

@ -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,
}
}

View file

@ -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;

View file

@ -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),
}
}