Make lead creation and invalidation for public reports work

The only thing wrong at this point that I can tell is that address
aren't being correctly populated when I reverse geocode.
This commit is contained in:
Eli Ribble 2026-03-14 01:14:30 +00:00
parent 3e1b56a266
commit e2af49a323
No known key found for this signature in database
27 changed files with 821 additions and 365 deletions

View file

@ -16,13 +16,17 @@ 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" `
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" `
ID null.Val[int64] `db:"id" `
TableName null.Val[string] `db:"table_name" `
AddressID null.Val[int32] `db:"address_id" `
AddressRaw null.Val[string] `db:"address_raw" `
Created null.Val[time.Time] `db:"created" `
Location null.Val[string] `db:"location" `
LocationLatitude null.Val[float64] `db:"location_latitude" `
LocationLongitude null.Val[float64] `db:"location_longitude" `
OrganizationID null.Val[int32] `db:"organization_id" `
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,29 +42,37 @@ type PublicreportReportLocationsQuery = *psql.ViewQuery[*PublicreportReportLocat
func buildPublicreportReportLocationColumns(alias string) publicreportReportLocationColumns {
return publicreportReportLocationColumns{
ColumnsExpr: expr.NewColumnsExpr(
"id", "table_name", "address_raw", "created", "location", "public_id", "status",
"id", "table_name", "address_id", "address_raw", "created", "location", "location_latitude", "location_longitude", "organization_id", "public_id", "status",
).WithParent("publicreport.report_location"),
tableAlias: alias,
ID: psql.Quote(alias, "id"),
TableName: psql.Quote(alias, "table_name"),
AddressRaw: psql.Quote(alias, "address_raw"),
Created: psql.Quote(alias, "created"),
Location: psql.Quote(alias, "location"),
PublicID: psql.Quote(alias, "public_id"),
Status: psql.Quote(alias, "status"),
tableAlias: alias,
ID: psql.Quote(alias, "id"),
TableName: psql.Quote(alias, "table_name"),
AddressID: psql.Quote(alias, "address_id"),
AddressRaw: psql.Quote(alias, "address_raw"),
Created: psql.Quote(alias, "created"),
Location: psql.Quote(alias, "location"),
LocationLatitude: psql.Quote(alias, "location_latitude"),
LocationLongitude: psql.Quote(alias, "location_longitude"),
OrganizationID: psql.Quote(alias, "organization_id"),
PublicID: psql.Quote(alias, "public_id"),
Status: psql.Quote(alias, "status"),
}
}
type publicreportReportLocationColumns struct {
expr.ColumnsExpr
tableAlias string
ID psql.Expression
TableName psql.Expression
AddressRaw psql.Expression
Created psql.Expression
Location psql.Expression
PublicID psql.Expression
Status psql.Expression
tableAlias string
ID psql.Expression
TableName psql.Expression
AddressID psql.Expression
AddressRaw psql.Expression
Created psql.Expression
Location psql.Expression
LocationLatitude psql.Expression
LocationLongitude psql.Expression
OrganizationID psql.Expression
PublicID psql.Expression
Status psql.Expression
}
func (c publicreportReportLocationColumns) Alias() string {
@ -96,13 +108,17 @@ func (o PublicreportReportLocationSlice) AfterQueryHook(ctx context.Context, exe
}
type publicreportReportLocationWhere[Q psql.Filterable] struct {
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]
ID psql.WhereNullMod[Q, int64]
TableName psql.WhereNullMod[Q, string]
AddressID psql.WhereNullMod[Q, int32]
AddressRaw psql.WhereNullMod[Q, string]
Created psql.WhereNullMod[Q, time.Time]
Location psql.WhereNullMod[Q, string]
LocationLatitude psql.WhereNullMod[Q, float64]
LocationLongitude psql.WhereNullMod[Q, float64]
OrganizationID psql.WhereNullMod[Q, int32]
PublicID psql.WhereNullMod[Q, string]
Status psql.WhereNullMod[Q, enums.PublicreportReportstatustype]
}
func (publicreportReportLocationWhere[Q]) AliasedAs(alias string) publicreportReportLocationWhere[Q] {
@ -111,12 +127,16 @@ 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),
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),
ID: psql.WhereNull[Q, int64](cols.ID),
TableName: psql.WhereNull[Q, string](cols.TableName),
AddressID: psql.WhereNull[Q, int32](cols.AddressID),
AddressRaw: psql.WhereNull[Q, string](cols.AddressRaw),
Created: psql.WhereNull[Q, time.Time](cols.Created),
Location: psql.WhereNull[Q, string](cols.Location),
LocationLatitude: psql.WhereNull[Q, float64](cols.LocationLatitude),
LocationLongitude: psql.WhereNull[Q, float64](cols.LocationLongitude),
OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID),
PublicID: psql.WhereNull[Q, string](cols.PublicID),
Status: psql.WhereNull[Q, enums.PublicreportReportstatustype](cols.Status),
}
}