Add address number to public reports
This commit is contained in:
parent
1e80c62701
commit
cfe399e44f
10 changed files with 125 additions and 26 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/google/uuid"
|
||||
//"github.com/Gleipnir-Technology/nidus-sync/platform"
|
||||
//"github.com/aarondl/opt/null"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/stephenafamo/scan"
|
||||
)
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ type reporter struct {
|
|||
type publicReport struct {
|
||||
AdditionalInfo string `json:"additional_info"`
|
||||
Address Address `json:"address"`
|
||||
AddressAsGiven string `json:"address_as_given"`
|
||||
Duration string `json:"duration"`
|
||||
Images []string `json:"images"`
|
||||
IsLocationBackyard bool `json:"is_location_backyard"`
|
||||
|
|
@ -57,13 +59,15 @@ type contentListCommunication struct {
|
|||
func listCommunication(ctx context.Context, r *http.Request, org *models.Organization, user *models.User, query queryParams) (*contentListCommunication, *nhttp.ErrorWithStatus) {
|
||||
type _Report struct {
|
||||
AdditionalInfo string `db:"additional_info"`
|
||||
AddressCountry string `db:"address_country" `
|
||||
AddressPlace string `db:"address_place" `
|
||||
AddressPostcode string `db:"address_postcode" `
|
||||
AddressRegion string `db:"address_region" `
|
||||
AddressStreet string `db:"address_street" `
|
||||
Created time.Time `db:"created" `
|
||||
Duration string `db:"duration" `
|
||||
AddressCountry string `db:"address_country"`
|
||||
AddressAsGiven string `db:"address"`
|
||||
AddressNumber string `db:"address_number"`
|
||||
AddressPlace string `db:"address_place"`
|
||||
AddressPostcode string `db:"address_postcode"`
|
||||
AddressRegion string `db:"address_region"`
|
||||
AddressStreet string `db:"address_street"`
|
||||
Created time.Time `db:"created"`
|
||||
Duration string `db:"duration"`
|
||||
IsLocationBackyard bool `db:"is_location_backyard"`
|
||||
IsLocationFrontyard bool `db:"is_location_frontyard"`
|
||||
IsLocationGarden bool `db:"is_location_garden"`
|
||||
|
|
@ -71,10 +75,10 @@ func listCommunication(ctx context.Context, r *http.Request, org *models.Organiz
|
|||
IsLocationPool bool `db:"is_location_pool"`
|
||||
Latitude float64 `db:"latitude"`
|
||||
Longitude float64 `db:"longitude"`
|
||||
PublicID string `db:"public_id" `
|
||||
ReporterEmail *string `db:"reporter_email" `
|
||||
ReporterName *string `db:"reporter_name" `
|
||||
ReporterPhone *string `db:"reporter_phone" `
|
||||
PublicID string `db:"public_id"`
|
||||
ReporterEmail *string `db:"reporter_email"`
|
||||
ReporterName *string `db:"reporter_name"`
|
||||
ReporterPhone *string `db:"reporter_phone"`
|
||||
SourceContainer bool `db:"source_container"`
|
||||
SourceDescription string `db:"source_description"`
|
||||
SourceGutter bool `db:"source_gutter"`
|
||||
|
|
@ -87,7 +91,9 @@ func listCommunication(ctx context.Context, r *http.Request, org *models.Organiz
|
|||
reports, err := bob.All(ctx, db.PGInstance.BobDB, psql.Select(
|
||||
sm.Columns(
|
||||
"additional_info",
|
||||
"address",
|
||||
"address_country",
|
||||
"address_number",
|
||||
"address_place",
|
||||
"address_postcode",
|
||||
"address_region",
|
||||
|
|
@ -163,13 +169,14 @@ func listCommunication(ctx context.Context, r *http.Request, org *models.Organiz
|
|||
ID: report.PublicID,
|
||||
PublicReport: publicReport{
|
||||
Address: Address{
|
||||
Country: report.AddressCountry,
|
||||
Locality: report.AddressPlace,
|
||||
//Number: report.Address
|
||||
Country: report.AddressCountry,
|
||||
Locality: report.AddressPlace,
|
||||
Number: report.AddressNumber,
|
||||
PostalCode: report.AddressPostcode,
|
||||
Region: report.AddressRegion,
|
||||
Street: report.AddressStreet,
|
||||
},
|
||||
AddressAsGiven: report.AddressAsGiven,
|
||||
AdditionalInfo: report.AdditionalInfo,
|
||||
Duration: report.Duration,
|
||||
Images: toImageURLs(id_to_images, report.PublicID),
|
||||
|
|
|
|||
|
|
@ -330,6 +330,15 @@ var PublicreportNuisances = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressNumber: column{
|
||||
Name: "address_number",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: publicreportNuisanceIndexes{
|
||||
NuisancePkey: index{
|
||||
|
|
@ -430,11 +439,12 @@ type publicreportNuisanceColumns struct {
|
|||
LatlngAccuracyValue column
|
||||
ReporterContactConsent column
|
||||
Location column
|
||||
AddressNumber column
|
||||
}
|
||||
|
||||
func (c publicreportNuisanceColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.AdditionalInfo, c.Created, c.Duration, c.SourceContainer, c.SourceDescription, c.SourceStagnant, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Status, c.OrganizationID, c.SourceGutter, c.H3cell, c.AddressCountry, c.AddressPlace, c.AddressPostcode, c.AddressRegion, c.AddressStreet, c.IsLocationBackyard, c.IsLocationFrontyard, c.IsLocationGarden, c.IsLocationOther, c.IsLocationPool, c.MapZoom, c.TodEarly, c.TodDay, c.TodEvening, c.TodNight, c.LatlngAccuracyType, c.LatlngAccuracyValue, c.ReporterContactConsent, c.Location,
|
||||
c.ID, c.AdditionalInfo, c.Created, c.Duration, c.SourceContainer, c.SourceDescription, c.SourceStagnant, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Status, c.OrganizationID, c.SourceGutter, c.H3cell, c.AddressCountry, c.AddressPlace, c.AddressPostcode, c.AddressRegion, c.AddressStreet, c.IsLocationBackyard, c.IsLocationFrontyard, c.IsLocationGarden, c.IsLocationOther, c.IsLocationPool, c.MapZoom, c.TodEarly, c.TodDay, c.TodEvening, c.TodNight, c.LatlngAccuracyType, c.LatlngAccuracyValue, c.ReporterContactConsent, c.Location, c.AddressNumber,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,15 @@ var PublicreportPools = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressNumber: column{
|
||||
Name: "address_number",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: publicreportPoolIndexes{
|
||||
PoolPkey: index{
|
||||
|
|
@ -420,11 +429,12 @@ type publicreportPoolColumns struct {
|
|||
IsReporterOwner column
|
||||
ReporterContactConsent column
|
||||
Location column
|
||||
AddressNumber column
|
||||
}
|
||||
|
||||
func (c publicreportPoolColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.AccessComments, c.AccessGate, c.AccessFence, c.AccessLocked, c.AccessDog, c.AccessOther, c.Address, c.AddressCountry, c.AddressPostCode, c.AddressPlace, c.AddressStreet, c.AddressRegion, c.Comments, c.Created, c.H3cell, c.HasAdult, c.HasLarvae, c.HasPupae, c.MapZoom, c.OwnerEmail, c.OwnerName, c.OwnerPhone, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Status, c.OrganizationID, c.HasBackyardPermission, c.IsReporterConfidential, c.IsReporterOwner, c.ReporterContactConsent, c.Location,
|
||||
c.ID, c.AccessComments, c.AccessGate, c.AccessFence, c.AccessLocked, c.AccessDog, c.AccessOther, c.Address, c.AddressCountry, c.AddressPostCode, c.AddressPlace, c.AddressStreet, c.AddressRegion, c.Comments, c.Created, c.H3cell, c.HasAdult, c.HasLarvae, c.HasPupae, c.MapZoom, c.OwnerEmail, c.OwnerName, c.OwnerPhone, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Status, c.OrganizationID, c.HasBackyardPermission, c.IsReporterConfidential, c.IsReporterOwner, c.ReporterContactConsent, c.Location, c.AddressNumber,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
12
db/migrations/00094_publicreport_address_number.sql
Normal file
12
db/migrations/00094_publicreport_address_number.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- +goose Up
|
||||
ALTER TABLE publicreport.nuisance ADD COLUMN address_number TEXT;
|
||||
UPDATE publicreport.nuisance SET address_number = '';
|
||||
ALTER TABLE publicreport.nuisance ALTER COLUMN address_number SET NOT NULL;
|
||||
|
||||
ALTER TABLE publicreport.pool ADD COLUMN address_number TEXT;
|
||||
UPDATE publicreport.pool SET address_number = '';
|
||||
ALTER TABLE publicreport.pool ALTER COLUMN address_number SET NOT NULL;
|
||||
-- +goose Down
|
||||
ALTER TABLE publicreport.pool DROP COLUMN address_number;
|
||||
ALTER TABLE publicreport.nuisance DROP COLUMN address_number;
|
||||
|
||||
|
|
@ -62,6 +62,7 @@ type PublicreportNuisance struct {
|
|||
LatlngAccuracyValue float32 `db:"latlng_accuracy_value" `
|
||||
ReporterContactConsent null.Val[bool] `db:"reporter_contact_consent" `
|
||||
Location null.Val[string] `db:"location" `
|
||||
AddressNumber string `db:"address_number" `
|
||||
|
||||
R publicreportNuisanceR `db:"-" `
|
||||
}
|
||||
|
|
@ -87,7 +88,7 @@ type publicreportNuisanceR struct {
|
|||
func buildPublicreportNuisanceColumns(alias string) publicreportNuisanceColumns {
|
||||
return publicreportNuisanceColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"id", "additional_info", "created", "duration", "source_container", "source_description", "source_stagnant", "public_id", "reporter_email", "reporter_name", "reporter_phone", "address", "status", "organization_id", "source_gutter", "h3cell", "address_country", "address_place", "address_postcode", "address_region", "address_street", "is_location_backyard", "is_location_frontyard", "is_location_garden", "is_location_other", "is_location_pool", "map_zoom", "tod_early", "tod_day", "tod_evening", "tod_night", "latlng_accuracy_type", "latlng_accuracy_value", "reporter_contact_consent", "location",
|
||||
"id", "additional_info", "created", "duration", "source_container", "source_description", "source_stagnant", "public_id", "reporter_email", "reporter_name", "reporter_phone", "address", "status", "organization_id", "source_gutter", "h3cell", "address_country", "address_place", "address_postcode", "address_region", "address_street", "is_location_backyard", "is_location_frontyard", "is_location_garden", "is_location_other", "is_location_pool", "map_zoom", "tod_early", "tod_day", "tod_evening", "tod_night", "latlng_accuracy_type", "latlng_accuracy_value", "reporter_contact_consent", "location", "address_number",
|
||||
).WithParent("publicreport.nuisance"),
|
||||
tableAlias: alias,
|
||||
ID: psql.Quote(alias, "id"),
|
||||
|
|
@ -125,6 +126,7 @@ func buildPublicreportNuisanceColumns(alias string) publicreportNuisanceColumns
|
|||
LatlngAccuracyValue: psql.Quote(alias, "latlng_accuracy_value"),
|
||||
ReporterContactConsent: psql.Quote(alias, "reporter_contact_consent"),
|
||||
Location: psql.Quote(alias, "location"),
|
||||
AddressNumber: psql.Quote(alias, "address_number"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -166,6 +168,7 @@ type publicreportNuisanceColumns struct {
|
|||
LatlngAccuracyValue psql.Expression
|
||||
ReporterContactConsent psql.Expression
|
||||
Location psql.Expression
|
||||
AddressNumber psql.Expression
|
||||
}
|
||||
|
||||
func (c publicreportNuisanceColumns) Alias() string {
|
||||
|
|
@ -215,10 +218,11 @@ type PublicreportNuisanceSetter struct {
|
|||
LatlngAccuracyValue omit.Val[float32] `db:"latlng_accuracy_value" `
|
||||
ReporterContactConsent omitnull.Val[bool] `db:"reporter_contact_consent" `
|
||||
Location omitnull.Val[string] `db:"location" `
|
||||
AddressNumber omit.Val[string] `db:"address_number" `
|
||||
}
|
||||
|
||||
func (s PublicreportNuisanceSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 35)
|
||||
vals := make([]string, 0, 36)
|
||||
if s.ID.IsValue() {
|
||||
vals = append(vals, "id")
|
||||
}
|
||||
|
|
@ -324,6 +328,9 @@ func (s PublicreportNuisanceSetter) SetColumns() []string {
|
|||
if !s.Location.IsUnset() {
|
||||
vals = append(vals, "location")
|
||||
}
|
||||
if s.AddressNumber.IsValue() {
|
||||
vals = append(vals, "address_number")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -433,6 +440,9 @@ func (s PublicreportNuisanceSetter) Overwrite(t *PublicreportNuisance) {
|
|||
if !s.Location.IsUnset() {
|
||||
t.Location = s.Location.MustGetNull()
|
||||
}
|
||||
if s.AddressNumber.IsValue() {
|
||||
t.AddressNumber = s.AddressNumber.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -441,7 +451,7 @@ func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) {
|
|||
})
|
||||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 35)
|
||||
vals := make([]bob.Expression, 36)
|
||||
if s.ID.IsValue() {
|
||||
vals[0] = psql.Arg(s.ID.MustGet())
|
||||
} else {
|
||||
|
|
@ -652,6 +662,12 @@ func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[34] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.AddressNumber.IsValue() {
|
||||
vals[35] = psql.Arg(s.AddressNumber.MustGet())
|
||||
} else {
|
||||
vals[35] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -661,7 +677,7 @@ func (s PublicreportNuisanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 35)
|
||||
exprs := make([]bob.Expression, 0, 36)
|
||||
|
||||
if s.ID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -908,6 +924,13 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi
|
|||
}})
|
||||
}
|
||||
|
||||
if s.AddressNumber.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "address_number")...),
|
||||
psql.Arg(s.AddressNumber),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
|
|
@ -1520,6 +1543,7 @@ type publicreportNuisanceWhere[Q psql.Filterable] struct {
|
|||
LatlngAccuracyValue psql.WhereMod[Q, float32]
|
||||
ReporterContactConsent psql.WhereNullMod[Q, bool]
|
||||
Location psql.WhereNullMod[Q, string]
|
||||
AddressNumber psql.WhereMod[Q, string]
|
||||
}
|
||||
|
||||
func (publicreportNuisanceWhere[Q]) AliasedAs(alias string) publicreportNuisanceWhere[Q] {
|
||||
|
|
@ -1563,6 +1587,7 @@ func buildPublicreportNuisanceWhere[Q psql.Filterable](cols publicreportNuisance
|
|||
LatlngAccuracyValue: psql.Where[Q, float32](cols.LatlngAccuracyValue),
|
||||
ReporterContactConsent: psql.WhereNull[Q, bool](cols.ReporterContactConsent),
|
||||
Location: psql.WhereNull[Q, string](cols.Location),
|
||||
AddressNumber: psql.Where[Q, string](cols.AddressNumber),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ type PublicreportPool struct {
|
|||
IsReporterOwner bool `db:"is_reporter_owner" `
|
||||
ReporterContactConsent null.Val[bool] `db:"reporter_contact_consent" `
|
||||
Location null.Val[string] `db:"location" `
|
||||
AddressNumber string `db:"address_number" `
|
||||
|
||||
R publicreportPoolR `db:"-" `
|
||||
}
|
||||
|
|
@ -86,7 +87,7 @@ type publicreportPoolR struct {
|
|||
func buildPublicreportPoolColumns(alias string) publicreportPoolColumns {
|
||||
return publicreportPoolColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"id", "access_comments", "access_gate", "access_fence", "access_locked", "access_dog", "access_other", "address", "address_country", "address_post_code", "address_place", "address_street", "address_region", "comments", "created", "h3cell", "has_adult", "has_larvae", "has_pupae", "map_zoom", "owner_email", "owner_name", "owner_phone", "public_id", "reporter_email", "reporter_name", "reporter_phone", "status", "organization_id", "has_backyard_permission", "is_reporter_confidential", "is_reporter_owner", "reporter_contact_consent", "location",
|
||||
"id", "access_comments", "access_gate", "access_fence", "access_locked", "access_dog", "access_other", "address", "address_country", "address_post_code", "address_place", "address_street", "address_region", "comments", "created", "h3cell", "has_adult", "has_larvae", "has_pupae", "map_zoom", "owner_email", "owner_name", "owner_phone", "public_id", "reporter_email", "reporter_name", "reporter_phone", "status", "organization_id", "has_backyard_permission", "is_reporter_confidential", "is_reporter_owner", "reporter_contact_consent", "location", "address_number",
|
||||
).WithParent("publicreport.pool"),
|
||||
tableAlias: alias,
|
||||
ID: psql.Quote(alias, "id"),
|
||||
|
|
@ -123,6 +124,7 @@ func buildPublicreportPoolColumns(alias string) publicreportPoolColumns {
|
|||
IsReporterOwner: psql.Quote(alias, "is_reporter_owner"),
|
||||
ReporterContactConsent: psql.Quote(alias, "reporter_contact_consent"),
|
||||
Location: psql.Quote(alias, "location"),
|
||||
AddressNumber: psql.Quote(alias, "address_number"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,6 +165,7 @@ type publicreportPoolColumns struct {
|
|||
IsReporterOwner psql.Expression
|
||||
ReporterContactConsent psql.Expression
|
||||
Location psql.Expression
|
||||
AddressNumber psql.Expression
|
||||
}
|
||||
|
||||
func (c publicreportPoolColumns) Alias() string {
|
||||
|
|
@ -211,10 +214,11 @@ type PublicreportPoolSetter struct {
|
|||
IsReporterOwner omit.Val[bool] `db:"is_reporter_owner" `
|
||||
ReporterContactConsent omitnull.Val[bool] `db:"reporter_contact_consent" `
|
||||
Location omitnull.Val[string] `db:"location" `
|
||||
AddressNumber omit.Val[string] `db:"address_number" `
|
||||
}
|
||||
|
||||
func (s PublicreportPoolSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 34)
|
||||
vals := make([]string, 0, 35)
|
||||
if s.ID.IsValue() {
|
||||
vals = append(vals, "id")
|
||||
}
|
||||
|
|
@ -317,6 +321,9 @@ func (s PublicreportPoolSetter) SetColumns() []string {
|
|||
if !s.Location.IsUnset() {
|
||||
vals = append(vals, "location")
|
||||
}
|
||||
if s.AddressNumber.IsValue() {
|
||||
vals = append(vals, "address_number")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -423,6 +430,9 @@ func (s PublicreportPoolSetter) Overwrite(t *PublicreportPool) {
|
|||
if !s.Location.IsUnset() {
|
||||
t.Location = s.Location.MustGetNull()
|
||||
}
|
||||
if s.AddressNumber.IsValue() {
|
||||
t.AddressNumber = s.AddressNumber.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublicreportPoolSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -431,7 +441,7 @@ func (s *PublicreportPoolSetter) Apply(q *dialect.InsertQuery) {
|
|||
})
|
||||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 34)
|
||||
vals := make([]bob.Expression, 35)
|
||||
if s.ID.IsValue() {
|
||||
vals[0] = psql.Arg(s.ID.MustGet())
|
||||
} else {
|
||||
|
|
@ -636,6 +646,12 @@ func (s *PublicreportPoolSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[33] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.AddressNumber.IsValue() {
|
||||
vals[34] = psql.Arg(s.AddressNumber.MustGet())
|
||||
} else {
|
||||
vals[34] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -645,7 +661,7 @@ func (s PublicreportPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s PublicreportPoolSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 34)
|
||||
exprs := make([]bob.Expression, 0, 35)
|
||||
|
||||
if s.ID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -885,6 +901,13 @@ func (s PublicreportPoolSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if s.AddressNumber.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "address_number")...),
|
||||
psql.Arg(s.AddressNumber),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
|
|
@ -1496,6 +1519,7 @@ type publicreportPoolWhere[Q psql.Filterable] struct {
|
|||
IsReporterOwner psql.WhereMod[Q, bool]
|
||||
ReporterContactConsent psql.WhereNullMod[Q, bool]
|
||||
Location psql.WhereNullMod[Q, string]
|
||||
AddressNumber psql.WhereMod[Q, string]
|
||||
}
|
||||
|
||||
func (publicreportPoolWhere[Q]) AliasedAs(alias string) publicreportPoolWhere[Q] {
|
||||
|
|
@ -1538,6 +1562,7 @@ func buildPublicreportPoolWhere[Q psql.Filterable](cols publicreportPoolColumns)
|
|||
IsReporterOwner: psql.Where[Q, bool](cols.IsReporterOwner),
|
||||
ReporterContactConsent: psql.WhereNull[Q, bool](cols.ReporterContactConsent),
|
||||
Location: psql.WhereNull[Q, string](cols.Location),
|
||||
AddressNumber: psql.Where[Q, string](cols.AddressNumber),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ function setLocationInputs(location) {
|
|||
let longitude = document.getElementById('longitude');
|
||||
let latlngAccuracyType = document.getElementById('latlng-accuracy-type');
|
||||
let latlngAccuracyValue = document.getElementById('latlng-accuracy-value');
|
||||
let number = document.getElementById('address-number');
|
||||
let postcode = document.getElementById('address-postcode');
|
||||
let place = document.getElementById('address-place');
|
||||
let region = document.getElementById('address-region');
|
||||
|
|
@ -92,10 +93,11 @@ function setLocationInputs(location) {
|
|||
longitude.value = props.coordinates.longitude;
|
||||
latlngAccuracyType.value = props.coordinates.accuracy;
|
||||
latlngAccuracyValue.value = "0";
|
||||
number.value = context.address.address_number;
|
||||
postcode.value = context.postcode.name;
|
||||
place.value = context.place.name;
|
||||
region.value = context.region.name;
|
||||
street.value = context.country.name;
|
||||
street.value = context.street.name;
|
||||
}
|
||||
function toggleCollapse(something) {
|
||||
el = document.getElementById(something)
|
||||
|
|
@ -236,6 +238,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
</div>
|
||||
<input type="hidden" id="map-zoom" name="map-zoom" />
|
||||
<input type="hidden" id="address-country" name="address-country" />
|
||||
<input type="hidden" id="address-number" name="address-number" />
|
||||
<input type="hidden" id="address-postcode" name="address-postcode" />
|
||||
<input type="hidden" id="address-place" name="address-place" />
|
||||
<input type="hidden" id="address-region" name="address-region" />
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ function setLocationInputs(location) {
|
|||
let longitude = document.getElementById('longitude');
|
||||
let latlngAccuracyType = document.getElementById('latlng-accuracy-type');
|
||||
let latlngAccuracyValue = document.getElementById('latlng-accuracy-value');
|
||||
let number = document.getElementById('address-number');
|
||||
let postcode = document.getElementById('address-postcode');
|
||||
let place = document.getElementById('address-place');
|
||||
let region = document.getElementById('address-region');
|
||||
|
|
@ -75,10 +76,11 @@ function setLocationInputs(location) {
|
|||
longitude.value = props.coordinates.longitude;
|
||||
latlngAccuracyType.value = props.coordinates.accuracy;
|
||||
latlngAccuracyValue.value = "0";
|
||||
number.value = context.address.address_number;
|
||||
postcode.value = context.postcode.name;
|
||||
place.value = context.place.name;
|
||||
region.value = context.region.name;
|
||||
street.value = context.country.name;
|
||||
street.value = context.street.name;
|
||||
}
|
||||
function toggleCollapse(something) {
|
||||
el = document.getElementById(something)
|
||||
|
|
@ -261,6 +263,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
id="address-postcode"
|
||||
name="address-postcode"
|
||||
/>
|
||||
<input type="hidden" id="address-number" name="address-number" />
|
||||
<input type="hidden" id="address-place" name="address-place" />
|
||||
<input type="hidden" id="address-region" name="address-region" />
|
||||
<input type="hidden" id="address-street" name="address-street" />
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
|
|||
additional_info := r.PostFormValue("additional-info")
|
||||
address := r.PostFormValue("address")
|
||||
address_country := r.PostFormValue("address-country")
|
||||
address_number := r.PostFormValue("address-number")
|
||||
address_place := r.PostFormValue("address-place")
|
||||
address_postcode := r.PostFormValue("address-postcode")
|
||||
address_region := r.PostFormValue("address-region")
|
||||
|
|
@ -172,6 +173,7 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
|
|||
AdditionalInfo: omit.From(additional_info),
|
||||
Address: omit.From(address),
|
||||
AddressCountry: omit.From(address_country),
|
||||
AddressNumber: omit.From(address_number),
|
||||
AddressPlace: omit.From(address_place),
|
||||
AddressPostcode: omit.From(address_postcode),
|
||||
AddressRegion: omit.From(address_region),
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ func postWater(w http.ResponseWriter, r *http.Request) {
|
|||
access_other := boolFromForm(r, "access-other")
|
||||
address := r.FormValue("address")
|
||||
address_country := r.FormValue("address-country")
|
||||
address_number := r.FormValue("address-number")
|
||||
address_postcode := r.FormValue("address-postcode")
|
||||
address_place := r.FormValue("address-place")
|
||||
address_region := r.FormValue("address-region")
|
||||
|
|
@ -133,6 +134,7 @@ func postWater(w http.ResponseWriter, r *http.Request) {
|
|||
AccessOther: omit.From(access_other),
|
||||
Address: omit.From(address),
|
||||
AddressCountry: omit.From(address_country),
|
||||
AddressNumber: omit.From(address_number),
|
||||
AddressPostCode: omit.From(address_postcode),
|
||||
AddressPlace: omit.From(address_place),
|
||||
AddressStreet: omit.From(address_street),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue