From 1fbe41b7258c46809e4fe7cae8470ea832c6a9b5 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 31 Jan 2026 15:39:14 +0000 Subject: [PATCH] Clean out a bunch of unused nuisance report fields Feedback had us simplify the form significantly --- db/dbinfo/import.district.bob.go | 12 +- db/dbinfo/publicreport.nuisance.bob.go | 156 ++----- db/factory/bobfactory_main.bob.go | 13 +- db/factory/bobfactory_random.bob.go | 30 -- db/factory/import.district.bob.go | 58 --- db/factory/publicreport.nuisance.bob.go | 562 +++--------------------- db/models/import.district.bob.go | 7 +- db/models/publicreport.nuisance.bob.go | 560 +++++++---------------- rmo/nuisance.go | 84 +--- rmo/template/nuisance.html | 2 +- 10 files changed, 264 insertions(+), 1220 deletions(-) diff --git a/db/dbinfo/import.district.bob.go b/db/dbinfo/import.district.bob.go index cefc73ed..20e19dd4 100644 --- a/db/dbinfo/import.district.bob.go +++ b/db/dbinfo/import.district.bob.go @@ -213,15 +213,6 @@ var ImportDistricts = Table[ Generated: false, AutoIncr: false, }, - Geom4326: column{ - Name: "geom_4326", - DBType: "geometry", - Default: "GENERATED", - Comment: "", - Nullable: true, - Generated: true, - AutoIncr: false, - }, }, Indexes: importDistrictIndexes{ DistrictPkey: index{ @@ -291,12 +282,11 @@ type importDistrictColumns struct { ShapeLe1 column ShapeArea column Geom column - Geom4326 column } func (c importDistrictColumns) AsSlice() []column { return []column{ - c.Gid, c.ID, c.Website, c.Contact, c.Address, c.Regionid, c.PostalCod, c.Phone1, c.Fax1, c.Agency, c.Code1, c.City1, c.ShapeLeng, c.Address2, c.GeneralMG, c.City2, c.PostalC1, c.Fax2, c.Phone2, c.ShapeLe1, c.ShapeArea, c.Geom, c.Geom4326, + c.Gid, c.ID, c.Website, c.Contact, c.Address, c.Regionid, c.PostalCod, c.Phone1, c.Fax1, c.Agency, c.Code1, c.City1, c.ShapeLeng, c.Address2, c.GeneralMG, c.City2, c.PostalC1, c.Fax2, c.Phone2, c.ShapeLe1, c.ShapeArea, c.Geom, } } diff --git a/db/dbinfo/publicreport.nuisance.bob.go b/db/dbinfo/publicreport.nuisance.bob.go index e8d1cad6..530edec0 100644 --- a/db/dbinfo/publicreport.nuisance.bob.go +++ b/db/dbinfo/publicreport.nuisance.bob.go @@ -51,24 +51,6 @@ var PublicreportNuisances = Table[ Generated: false, AutoIncr: false, }, - Email: column{ - Name: "email", - DBType: "text", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - InspectionType: column{ - Name: "inspection_type", - DBType: "publicreport.nuisanceinspectiontype", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, SourceLocation: column{ Name: "source_location", DBType: "publicreport.nuisancelocationtype", @@ -78,42 +60,6 @@ var PublicreportNuisances = Table[ Generated: false, AutoIncr: false, }, - PreferredDateRange: column{ - Name: "preferred_date_range", - DBType: "publicreport.nuisancepreferreddaterangetype", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - PreferredTime: column{ - Name: "preferred_time", - DBType: "publicreport.nuisancepreferredtimetype", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - RequestCall: column{ - Name: "request_call", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - Severity: column{ - Name: "severity", - DBType: "smallint", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, SourceContainer: column{ Name: "source_container", DBType: "boolean", @@ -132,15 +78,6 @@ var PublicreportNuisances = Table[ Generated: false, AutoIncr: false, }, - SourceRoof: column{ - Name: "source_roof", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, SourceStagnant: column{ Name: "source_stagnant", DBType: "boolean", @@ -150,42 +87,6 @@ var PublicreportNuisances = Table[ Generated: false, AutoIncr: false, }, - TimeOfDayDay: column{ - Name: "time_of_day_day", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - TimeOfDayEarly: column{ - Name: "time_of_day_early", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - TimeOfDayEvening: column{ - Name: "time_of_day_evening", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - TimeOfDayNight: column{ - Name: "time_of_day_night", - DBType: "boolean", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, PublicID: column{ Name: "public_id", DBType: "text", @@ -267,6 +168,15 @@ var PublicreportNuisances = Table[ Generated: false, AutoIncr: false, }, + SourceGutter: column{ + Name: "source_gutter", + DBType: "boolean", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, }, Indexes: publicreportNuisanceIndexes{ NuisancePkey: index{ @@ -332,39 +242,29 @@ var PublicreportNuisances = Table[ } type publicreportNuisanceColumns struct { - ID column - AdditionalInfo column - Created column - Duration column - Email column - InspectionType column - SourceLocation column - PreferredDateRange column - PreferredTime column - RequestCall column - Severity column - SourceContainer column - SourceDescription column - SourceRoof column - SourceStagnant column - TimeOfDayDay column - TimeOfDayEarly column - TimeOfDayEvening column - TimeOfDayNight column - PublicID column - ReporterAddress column - ReporterEmail column - ReporterName column - ReporterPhone column - Address column - Location column - Status column - OrganizationID column + ID column + AdditionalInfo column + Created column + Duration column + SourceLocation column + SourceContainer column + SourceDescription column + SourceStagnant column + PublicID column + ReporterAddress column + ReporterEmail column + ReporterName column + ReporterPhone column + Address column + Location column + Status column + OrganizationID column + SourceGutter column } func (c publicreportNuisanceColumns) AsSlice() []column { return []column{ - c.ID, c.AdditionalInfo, c.Created, c.Duration, c.Email, c.InspectionType, c.SourceLocation, c.PreferredDateRange, c.PreferredTime, c.RequestCall, c.Severity, c.SourceContainer, c.SourceDescription, c.SourceRoof, c.SourceStagnant, c.TimeOfDayDay, c.TimeOfDayEarly, c.TimeOfDayEvening, c.TimeOfDayNight, c.PublicID, c.ReporterAddress, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Location, c.Status, c.OrganizationID, + c.ID, c.AdditionalInfo, c.Created, c.Duration, c.SourceLocation, c.SourceContainer, c.SourceDescription, c.SourceStagnant, c.PublicID, c.ReporterAddress, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Location, c.Status, c.OrganizationID, c.SourceGutter, } } diff --git a/db/factory/bobfactory_main.bob.go b/db/factory/bobfactory_main.bob.go index ace24ffd..958374f0 100644 --- a/db/factory/bobfactory_main.bob.go +++ b/db/factory/bobfactory_main.bob.go @@ -2300,7 +2300,6 @@ func (f *Factory) FromExistingImportDistrict(m *models.ImportDistrict) *ImportDi o.ShapeLe1 = func() null.Val[decimal.Decimal] { return m.ShapeLe1 } o.ShapeArea = func() null.Val[decimal.Decimal] { return m.ShapeArea } o.Geom = func() null.Val[string] { return m.Geom } - o.Geom4326 = func() null.Val[string] { return m.Geom4326 } ctx := context.Background() if m.R.ImportDistrictGidOrganization != nil { @@ -2851,21 +2850,10 @@ func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisanc o.AdditionalInfo = func() string { return m.AdditionalInfo } o.Created = func() time.Time { return m.Created } o.Duration = func() enums.PublicreportNuisancedurationtype { return m.Duration } - o.Email = func() string { return m.Email } - o.InspectionType = func() enums.PublicreportNuisanceinspectiontype { return m.InspectionType } o.SourceLocation = func() enums.PublicreportNuisancelocationtype { return m.SourceLocation } - o.PreferredDateRange = func() enums.PublicreportNuisancepreferreddaterangetype { return m.PreferredDateRange } - o.PreferredTime = func() enums.PublicreportNuisancepreferredtimetype { return m.PreferredTime } - o.RequestCall = func() bool { return m.RequestCall } - o.Severity = func() int16 { return m.Severity } o.SourceContainer = func() bool { return m.SourceContainer } o.SourceDescription = func() string { return m.SourceDescription } - o.SourceRoof = func() bool { return m.SourceRoof } o.SourceStagnant = func() bool { return m.SourceStagnant } - o.TimeOfDayDay = func() bool { return m.TimeOfDayDay } - o.TimeOfDayEarly = func() bool { return m.TimeOfDayEarly } - o.TimeOfDayEvening = func() bool { return m.TimeOfDayEvening } - o.TimeOfDayNight = func() bool { return m.TimeOfDayNight } o.PublicID = func() string { return m.PublicID } o.ReporterAddress = func() string { return m.ReporterAddress } o.ReporterEmail = func() string { return m.ReporterEmail } @@ -2875,6 +2863,7 @@ func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisanc o.Location = func() null.Val[string] { return m.Location } o.Status = func() enums.PublicreportReportstatustype { return m.Status } o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } + o.SourceGutter = func() bool { return m.SourceGutter } ctx := context.Background() if m.R.Organization != nil { diff --git a/db/factory/bobfactory_random.bob.go b/db/factory/bobfactory_random.bob.go index 75ff76b2..70df0b0d 100644 --- a/db/factory/bobfactory_random.bob.go +++ b/db/factory/bobfactory_random.bob.go @@ -171,16 +171,6 @@ func random_enums_PublicreportNuisancedurationtype(f *faker.Faker, limits ...str return all[f.IntBetween(0, len(all)-1)] } -func random_enums_PublicreportNuisanceinspectiontype(f *faker.Faker, limits ...string) enums.PublicreportNuisanceinspectiontype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportNuisanceinspectiontype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - func random_enums_PublicreportNuisancelocationtype(f *faker.Faker, limits ...string) enums.PublicreportNuisancelocationtype { if f == nil { f = &defaultFaker @@ -191,26 +181,6 @@ func random_enums_PublicreportNuisancelocationtype(f *faker.Faker, limits ...str return all[f.IntBetween(0, len(all)-1)] } -func random_enums_PublicreportNuisancepreferreddaterangetype(f *faker.Faker, limits ...string) enums.PublicreportNuisancepreferreddaterangetype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportNuisancepreferreddaterangetype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_PublicreportNuisancepreferredtimetype(f *faker.Faker, limits ...string) enums.PublicreportNuisancepreferredtimetype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportNuisancepreferredtimetype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - func random_enums_PublicreportReportstatustype(f *faker.Faker, limits ...string) enums.PublicreportReportstatustype { if f == nil { f = &defaultFaker diff --git a/db/factory/import.district.bob.go b/db/factory/import.district.bob.go index 3cadd923..a86d4164 100644 --- a/db/factory/import.district.bob.go +++ b/db/factory/import.district.bob.go @@ -59,7 +59,6 @@ type ImportDistrictTemplate struct { ShapeLe1 func() null.Val[decimal.Decimal] ShapeArea func() null.Val[decimal.Decimal] Geom func() null.Val[string] - Geom4326 func() null.Val[string] r importDistrictR f *Factory @@ -274,9 +273,6 @@ func (o ImportDistrictTemplate) Build() *models.ImportDistrict { if o.Geom != nil { m.Geom = o.Geom() } - if o.Geom4326 != nil { - m.Geom4326 = o.Geom4326() - } o.setModelRels(m) @@ -438,7 +434,6 @@ func (m importDistrictMods) RandomizeAllColumns(f *faker.Faker) ImportDistrictMo ImportDistrictMods.RandomShapeLe1(f), ImportDistrictMods.RandomShapeArea(f), ImportDistrictMods.RandomGeom(f), - ImportDistrictMods.RandomGeom4326(f), } } @@ -1586,59 +1581,6 @@ func (m importDistrictMods) RandomGeomNotNull(f *faker.Faker) ImportDistrictMod }) } -// Set the model columns to this value -func (m importDistrictMods) Geom4326(val null.Val[string]) ImportDistrictMod { - return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) { - o.Geom4326 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m importDistrictMods) Geom4326Func(f func() null.Val[string]) ImportDistrictMod { - return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) { - o.Geom4326 = f - }) -} - -// Clear any values for the column -func (m importDistrictMods) UnsetGeom4326() ImportDistrictMod { - return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) { - o.Geom4326 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m importDistrictMods) RandomGeom4326(f *faker.Faker) ImportDistrictMod { - return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) { - o.Geom4326 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m importDistrictMods) RandomGeom4326NotNull(f *faker.Faker) ImportDistrictMod { - return ImportDistrictModFunc(func(_ context.Context, o *ImportDistrictTemplate) { - o.Geom4326 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - func (m importDistrictMods) WithParentsCascading() ImportDistrictMod { return ImportDistrictModFunc(func(ctx context.Context, o *ImportDistrictTemplate) { if isDone, _ := importDistrictWithParentsCascadingCtx.Value(ctx); isDone { diff --git a/db/factory/publicreport.nuisance.bob.go b/db/factory/publicreport.nuisance.bob.go index aa9b49de..923ceed8 100644 --- a/db/factory/publicreport.nuisance.bob.go +++ b/db/factory/publicreport.nuisance.bob.go @@ -38,34 +38,24 @@ func (mods PublicreportNuisanceModSlice) Apply(ctx context.Context, n *Publicrep // PublicreportNuisanceTemplate is an object representing the database table. // all columns are optional and should be set by mods type PublicreportNuisanceTemplate struct { - ID func() int32 - AdditionalInfo func() string - Created func() time.Time - Duration func() enums.PublicreportNuisancedurationtype - Email func() string - InspectionType func() enums.PublicreportNuisanceinspectiontype - SourceLocation func() enums.PublicreportNuisancelocationtype - PreferredDateRange func() enums.PublicreportNuisancepreferreddaterangetype - PreferredTime func() enums.PublicreportNuisancepreferredtimetype - RequestCall func() bool - Severity func() int16 - SourceContainer func() bool - SourceDescription func() string - SourceRoof func() bool - SourceStagnant func() bool - TimeOfDayDay func() bool - TimeOfDayEarly func() bool - TimeOfDayEvening func() bool - TimeOfDayNight func() bool - PublicID func() string - ReporterAddress func() string - ReporterEmail func() string - ReporterName func() string - ReporterPhone func() string - Address func() string - Location func() null.Val[string] - Status func() enums.PublicreportReportstatustype - OrganizationID func() null.Val[int32] + ID func() int32 + AdditionalInfo func() string + Created func() time.Time + Duration func() enums.PublicreportNuisancedurationtype + SourceLocation func() enums.PublicreportNuisancelocationtype + SourceContainer func() bool + SourceDescription func() string + SourceStagnant func() bool + PublicID func() string + ReporterAddress func() string + ReporterEmail func() string + ReporterName func() string + ReporterPhone func() string + Address func() string + Location func() null.Val[string] + Status func() enums.PublicreportReportstatustype + OrganizationID func() null.Val[int32] + SourceGutter func() bool r publicreportNuisanceR f *Factory @@ -120,34 +110,10 @@ func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisance val := o.Duration() m.Duration = omit.From(val) } - if o.Email != nil { - val := o.Email() - m.Email = omit.From(val) - } - if o.InspectionType != nil { - val := o.InspectionType() - m.InspectionType = omit.From(val) - } if o.SourceLocation != nil { val := o.SourceLocation() m.SourceLocation = omit.From(val) } - if o.PreferredDateRange != nil { - val := o.PreferredDateRange() - m.PreferredDateRange = omit.From(val) - } - if o.PreferredTime != nil { - val := o.PreferredTime() - m.PreferredTime = omit.From(val) - } - if o.RequestCall != nil { - val := o.RequestCall() - m.RequestCall = omit.From(val) - } - if o.Severity != nil { - val := o.Severity() - m.Severity = omit.From(val) - } if o.SourceContainer != nil { val := o.SourceContainer() m.SourceContainer = omit.From(val) @@ -156,30 +122,10 @@ func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisance val := o.SourceDescription() m.SourceDescription = omit.From(val) } - if o.SourceRoof != nil { - val := o.SourceRoof() - m.SourceRoof = omit.From(val) - } if o.SourceStagnant != nil { val := o.SourceStagnant() m.SourceStagnant = omit.From(val) } - if o.TimeOfDayDay != nil { - val := o.TimeOfDayDay() - m.TimeOfDayDay = omit.From(val) - } - if o.TimeOfDayEarly != nil { - val := o.TimeOfDayEarly() - m.TimeOfDayEarly = omit.From(val) - } - if o.TimeOfDayEvening != nil { - val := o.TimeOfDayEvening() - m.TimeOfDayEvening = omit.From(val) - } - if o.TimeOfDayNight != nil { - val := o.TimeOfDayNight() - m.TimeOfDayNight = omit.From(val) - } if o.PublicID != nil { val := o.PublicID() m.PublicID = omit.From(val) @@ -216,6 +162,10 @@ func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisance val := o.OrganizationID() m.OrganizationID = omitnull.FromNull(val) } + if o.SourceGutter != nil { + val := o.SourceGutter() + m.SourceGutter = omit.From(val) + } return m } @@ -250,51 +200,18 @@ func (o PublicreportNuisanceTemplate) Build() *models.PublicreportNuisance { if o.Duration != nil { m.Duration = o.Duration() } - if o.Email != nil { - m.Email = o.Email() - } - if o.InspectionType != nil { - m.InspectionType = o.InspectionType() - } if o.SourceLocation != nil { m.SourceLocation = o.SourceLocation() } - if o.PreferredDateRange != nil { - m.PreferredDateRange = o.PreferredDateRange() - } - if o.PreferredTime != nil { - m.PreferredTime = o.PreferredTime() - } - if o.RequestCall != nil { - m.RequestCall = o.RequestCall() - } - if o.Severity != nil { - m.Severity = o.Severity() - } if o.SourceContainer != nil { m.SourceContainer = o.SourceContainer() } if o.SourceDescription != nil { m.SourceDescription = o.SourceDescription() } - if o.SourceRoof != nil { - m.SourceRoof = o.SourceRoof() - } if o.SourceStagnant != nil { m.SourceStagnant = o.SourceStagnant() } - if o.TimeOfDayDay != nil { - m.TimeOfDayDay = o.TimeOfDayDay() - } - if o.TimeOfDayEarly != nil { - m.TimeOfDayEarly = o.TimeOfDayEarly() - } - if o.TimeOfDayEvening != nil { - m.TimeOfDayEvening = o.TimeOfDayEvening() - } - if o.TimeOfDayNight != nil { - m.TimeOfDayNight = o.TimeOfDayNight() - } if o.PublicID != nil { m.PublicID = o.PublicID() } @@ -322,6 +239,9 @@ func (o PublicreportNuisanceTemplate) Build() *models.PublicreportNuisance { if o.OrganizationID != nil { m.OrganizationID = o.OrganizationID() } + if o.SourceGutter != nil { + m.SourceGutter = o.SourceGutter() + } o.setModelRels(m) @@ -354,34 +274,10 @@ func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) { val := random_enums_PublicreportNuisancedurationtype(nil) m.Duration = omit.From(val) } - if !(m.Email.IsValue()) { - val := random_string(nil) - m.Email = omit.From(val) - } - if !(m.InspectionType.IsValue()) { - val := random_enums_PublicreportNuisanceinspectiontype(nil) - m.InspectionType = omit.From(val) - } if !(m.SourceLocation.IsValue()) { val := random_enums_PublicreportNuisancelocationtype(nil) m.SourceLocation = omit.From(val) } - if !(m.PreferredDateRange.IsValue()) { - val := random_enums_PublicreportNuisancepreferreddaterangetype(nil) - m.PreferredDateRange = omit.From(val) - } - if !(m.PreferredTime.IsValue()) { - val := random_enums_PublicreportNuisancepreferredtimetype(nil) - m.PreferredTime = omit.From(val) - } - if !(m.RequestCall.IsValue()) { - val := random_bool(nil) - m.RequestCall = omit.From(val) - } - if !(m.Severity.IsValue()) { - val := random_int16(nil) - m.Severity = omit.From(val) - } if !(m.SourceContainer.IsValue()) { val := random_bool(nil) m.SourceContainer = omit.From(val) @@ -390,30 +286,10 @@ func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) { val := random_string(nil) m.SourceDescription = omit.From(val) } - if !(m.SourceRoof.IsValue()) { - val := random_bool(nil) - m.SourceRoof = omit.From(val) - } if !(m.SourceStagnant.IsValue()) { val := random_bool(nil) m.SourceStagnant = omit.From(val) } - if !(m.TimeOfDayDay.IsValue()) { - val := random_bool(nil) - m.TimeOfDayDay = omit.From(val) - } - if !(m.TimeOfDayEarly.IsValue()) { - val := random_bool(nil) - m.TimeOfDayEarly = omit.From(val) - } - if !(m.TimeOfDayEvening.IsValue()) { - val := random_bool(nil) - m.TimeOfDayEvening = omit.From(val) - } - if !(m.TimeOfDayNight.IsValue()) { - val := random_bool(nil) - m.TimeOfDayNight = omit.From(val) - } if !(m.PublicID.IsValue()) { val := random_string(nil) m.PublicID = omit.From(val) @@ -442,6 +318,10 @@ func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) { val := random_enums_PublicreportReportstatustype(nil) m.Status = omit.From(val) } + if !(m.SourceGutter.IsValue()) { + val := random_bool(nil) + m.SourceGutter = omit.From(val) + } } // insertOptRels creates and inserts any optional the relationships on *models.PublicreportNuisance @@ -565,21 +445,10 @@ func (m publicreportNuisanceMods) RandomizeAllColumns(f *faker.Faker) Publicrepo PublicreportNuisanceMods.RandomAdditionalInfo(f), PublicreportNuisanceMods.RandomCreated(f), PublicreportNuisanceMods.RandomDuration(f), - PublicreportNuisanceMods.RandomEmail(f), - PublicreportNuisanceMods.RandomInspectionType(f), PublicreportNuisanceMods.RandomSourceLocation(f), - PublicreportNuisanceMods.RandomPreferredDateRange(f), - PublicreportNuisanceMods.RandomPreferredTime(f), - PublicreportNuisanceMods.RandomRequestCall(f), - PublicreportNuisanceMods.RandomSeverity(f), PublicreportNuisanceMods.RandomSourceContainer(f), PublicreportNuisanceMods.RandomSourceDescription(f), - PublicreportNuisanceMods.RandomSourceRoof(f), PublicreportNuisanceMods.RandomSourceStagnant(f), - PublicreportNuisanceMods.RandomTimeOfDayDay(f), - PublicreportNuisanceMods.RandomTimeOfDayEarly(f), - PublicreportNuisanceMods.RandomTimeOfDayEvening(f), - PublicreportNuisanceMods.RandomTimeOfDayNight(f), PublicreportNuisanceMods.RandomPublicID(f), PublicreportNuisanceMods.RandomReporterAddress(f), PublicreportNuisanceMods.RandomReporterEmail(f), @@ -589,6 +458,7 @@ func (m publicreportNuisanceMods) RandomizeAllColumns(f *faker.Faker) Publicrepo PublicreportNuisanceMods.RandomLocation(f), PublicreportNuisanceMods.RandomStatus(f), PublicreportNuisanceMods.RandomOrganizationID(f), + PublicreportNuisanceMods.RandomSourceGutter(f), } } @@ -716,68 +586,6 @@ func (m publicreportNuisanceMods) RandomDuration(f *faker.Faker) PublicreportNui }) } -// Set the model columns to this value -func (m publicreportNuisanceMods) Email(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Email = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) EmailFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Email = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetEmail() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Email = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomEmail(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Email = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) InspectionType(val enums.PublicreportNuisanceinspectiontype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.InspectionType = func() enums.PublicreportNuisanceinspectiontype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) InspectionTypeFunc(f func() enums.PublicreportNuisanceinspectiontype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.InspectionType = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetInspectionType() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.InspectionType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomInspectionType(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.InspectionType = func() enums.PublicreportNuisanceinspectiontype { - return random_enums_PublicreportNuisanceinspectiontype(f) - } - }) -} - // Set the model columns to this value func (m publicreportNuisanceMods) SourceLocation(val enums.PublicreportNuisancelocationtype) PublicreportNuisanceMod { return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { @@ -809,130 +617,6 @@ func (m publicreportNuisanceMods) RandomSourceLocation(f *faker.Faker) Publicrep }) } -// Set the model columns to this value -func (m publicreportNuisanceMods) PreferredDateRange(val enums.PublicreportNuisancepreferreddaterangetype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredDateRange = func() enums.PublicreportNuisancepreferreddaterangetype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) PreferredDateRangeFunc(f func() enums.PublicreportNuisancepreferreddaterangetype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredDateRange = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetPreferredDateRange() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredDateRange = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomPreferredDateRange(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredDateRange = func() enums.PublicreportNuisancepreferreddaterangetype { - return random_enums_PublicreportNuisancepreferreddaterangetype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) PreferredTime(val enums.PublicreportNuisancepreferredtimetype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredTime = func() enums.PublicreportNuisancepreferredtimetype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) PreferredTimeFunc(f func() enums.PublicreportNuisancepreferredtimetype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredTime = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetPreferredTime() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredTime = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomPreferredTime(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PreferredTime = func() enums.PublicreportNuisancepreferredtimetype { - return random_enums_PublicreportNuisancepreferredtimetype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) RequestCall(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.RequestCall = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) RequestCallFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.RequestCall = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetRequestCall() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.RequestCall = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomRequestCall(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.RequestCall = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Severity(val int16) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Severity = func() int16 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SeverityFunc(f func() int16) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Severity = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSeverity() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Severity = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSeverity(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Severity = func() int16 { - return random_int16(f) - } - }) -} - // Set the model columns to this value func (m publicreportNuisanceMods) SourceContainer(val bool) PublicreportNuisanceMod { return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { @@ -995,37 +679,6 @@ func (m publicreportNuisanceMods) RandomSourceDescription(f *faker.Faker) Public }) } -// Set the model columns to this value -func (m publicreportNuisanceMods) SourceRoof(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceRoof = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SourceRoofFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceRoof = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSourceRoof() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceRoof = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSourceRoof(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceRoof = func() bool { - return random_bool(f) - } - }) -} - // Set the model columns to this value func (m publicreportNuisanceMods) SourceStagnant(val bool) PublicreportNuisanceMod { return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { @@ -1057,130 +710,6 @@ func (m publicreportNuisanceMods) RandomSourceStagnant(f *faker.Faker) Publicrep }) } -// Set the model columns to this value -func (m publicreportNuisanceMods) TimeOfDayDay(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayDay = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TimeOfDayDayFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayDay = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTimeOfDayDay() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayDay = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTimeOfDayDay(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayDay = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TimeOfDayEarly(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEarly = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TimeOfDayEarlyFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEarly = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTimeOfDayEarly() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEarly = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTimeOfDayEarly(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEarly = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TimeOfDayEvening(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEvening = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TimeOfDayEveningFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEvening = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTimeOfDayEvening() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEvening = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTimeOfDayEvening(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayEvening = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TimeOfDayNight(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayNight = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TimeOfDayNightFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayNight = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTimeOfDayNight() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayNight = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTimeOfDayNight(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TimeOfDayNight = func() bool { - return random_bool(f) - } - }) -} - // Set the model columns to this value func (m publicreportNuisanceMods) PublicID(val string) PublicreportNuisanceMod { return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { @@ -1504,6 +1033,37 @@ func (m publicreportNuisanceMods) RandomOrganizationIDNotNull(f *faker.Faker) Pu }) } +// Set the model columns to this value +func (m publicreportNuisanceMods) SourceGutter(val bool) PublicreportNuisanceMod { + return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { + o.SourceGutter = func() bool { return val } + }) +} + +// Set the Column from the function +func (m publicreportNuisanceMods) SourceGutterFunc(f func() bool) PublicreportNuisanceMod { + return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { + o.SourceGutter = f + }) +} + +// Clear any values for the column +func (m publicreportNuisanceMods) UnsetSourceGutter() PublicreportNuisanceMod { + return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { + o.SourceGutter = nil + }) +} + +// Generates a random value for the column using the given faker +// if faker is nil, a default faker is used +func (m publicreportNuisanceMods) RandomSourceGutter(f *faker.Faker) PublicreportNuisanceMod { + return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { + o.SourceGutter = func() bool { + return random_bool(f) + } + }) +} + func (m publicreportNuisanceMods) WithParentsCascading() PublicreportNuisanceMod { return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { if isDone, _ := publicreportNuisanceWithParentsCascadingCtx.Value(ctx); isDone { diff --git a/db/models/import.district.bob.go b/db/models/import.district.bob.go index 6523d151..64039e8c 100644 --- a/db/models/import.district.bob.go +++ b/db/models/import.district.bob.go @@ -48,7 +48,6 @@ type ImportDistrict struct { ShapeLe1 null.Val[decimal.Decimal] `db:"shape_le_1" ` ShapeArea null.Val[decimal.Decimal] `db:"shape_area" ` Geom null.Val[string] `db:"geom" ` - Geom4326 null.Val[string] `db:"geom_4326,generated" ` R importDistrictR `db:"-" ` } @@ -71,7 +70,7 @@ type importDistrictR struct { func buildImportDistrictColumns(alias string) importDistrictColumns { return importDistrictColumns{ ColumnsExpr: expr.NewColumnsExpr( - "gid", "id", "website", "contact", "address", "regionid", "postal_cod", "phone1", "fax1", "agency", "code1", "city1", "shape_leng", "address2", "general_mg", "city2", "postal_c_1", "fax2", "phone2", "shape_le_1", "shape_area", "geom", "geom_4326", + "gid", "id", "website", "contact", "address", "regionid", "postal_cod", "phone1", "fax1", "agency", "code1", "city1", "shape_leng", "address2", "general_mg", "city2", "postal_c_1", "fax2", "phone2", "shape_le_1", "shape_area", "geom", ).WithParent("import.district"), tableAlias: alias, Gid: psql.Quote(alias, "gid"), @@ -96,7 +95,6 @@ func buildImportDistrictColumns(alias string) importDistrictColumns { ShapeLe1: psql.Quote(alias, "shape_le_1"), ShapeArea: psql.Quote(alias, "shape_area"), Geom: psql.Quote(alias, "geom"), - Geom4326: psql.Quote(alias, "geom_4326"), } } @@ -125,7 +123,6 @@ type importDistrictColumns struct { ShapeLe1 psql.Expression ShapeArea psql.Expression Geom psql.Expression - Geom4326 psql.Expression } func (c importDistrictColumns) Alias() string { @@ -935,7 +932,6 @@ type importDistrictWhere[Q psql.Filterable] struct { ShapeLe1 psql.WhereNullMod[Q, decimal.Decimal] ShapeArea psql.WhereNullMod[Q, decimal.Decimal] Geom psql.WhereNullMod[Q, string] - Geom4326 psql.WhereNullMod[Q, string] } func (importDistrictWhere[Q]) AliasedAs(alias string) importDistrictWhere[Q] { @@ -966,7 +962,6 @@ func buildImportDistrictWhere[Q psql.Filterable](cols importDistrictColumns) imp ShapeLe1: psql.WhereNull[Q, decimal.Decimal](cols.ShapeLe1), ShapeArea: psql.WhereNull[Q, decimal.Decimal](cols.ShapeArea), Geom: psql.WhereNull[Q, string](cols.Geom), - Geom4326: psql.WhereNull[Q, string](cols.Geom4326), } } diff --git a/db/models/publicreport.nuisance.bob.go b/db/models/publicreport.nuisance.bob.go index ad16bd4f..c241769b 100644 --- a/db/models/publicreport.nuisance.bob.go +++ b/db/models/publicreport.nuisance.bob.go @@ -27,34 +27,24 @@ import ( // PublicreportNuisance is an object representing the database table. type PublicreportNuisance struct { - ID int32 `db:"id,pk" ` - AdditionalInfo string `db:"additional_info" ` - Created time.Time `db:"created" ` - Duration enums.PublicreportNuisancedurationtype `db:"duration" ` - Email string `db:"email" ` - InspectionType enums.PublicreportNuisanceinspectiontype `db:"inspection_type" ` - SourceLocation enums.PublicreportNuisancelocationtype `db:"source_location" ` - PreferredDateRange enums.PublicreportNuisancepreferreddaterangetype `db:"preferred_date_range" ` - PreferredTime enums.PublicreportNuisancepreferredtimetype `db:"preferred_time" ` - RequestCall bool `db:"request_call" ` - Severity int16 `db:"severity" ` - SourceContainer bool `db:"source_container" ` - SourceDescription string `db:"source_description" ` - SourceRoof bool `db:"source_roof" ` - SourceStagnant bool `db:"source_stagnant" ` - TimeOfDayDay bool `db:"time_of_day_day" ` - TimeOfDayEarly bool `db:"time_of_day_early" ` - TimeOfDayEvening bool `db:"time_of_day_evening" ` - TimeOfDayNight bool `db:"time_of_day_night" ` - PublicID string `db:"public_id" ` - ReporterAddress string `db:"reporter_address" ` - ReporterEmail string `db:"reporter_email" ` - ReporterName string `db:"reporter_name" ` - ReporterPhone string `db:"reporter_phone" ` - Address string `db:"address" ` - Location null.Val[string] `db:"location" ` - Status enums.PublicreportReportstatustype `db:"status" ` - OrganizationID null.Val[int32] `db:"organization_id" ` + ID int32 `db:"id,pk" ` + AdditionalInfo string `db:"additional_info" ` + Created time.Time `db:"created" ` + Duration enums.PublicreportNuisancedurationtype `db:"duration" ` + SourceLocation enums.PublicreportNuisancelocationtype `db:"source_location" ` + SourceContainer bool `db:"source_container" ` + SourceDescription string `db:"source_description" ` + SourceStagnant bool `db:"source_stagnant" ` + PublicID string `db:"public_id" ` + ReporterAddress string `db:"reporter_address" ` + ReporterEmail string `db:"reporter_email" ` + ReporterName string `db:"reporter_name" ` + ReporterPhone string `db:"reporter_phone" ` + Address string `db:"address" ` + Location null.Val[string] `db:"location" ` + Status enums.PublicreportReportstatustype `db:"status" ` + OrganizationID null.Val[int32] `db:"organization_id" ` + SourceGutter bool `db:"source_gutter" ` R publicreportNuisanceR `db:"-" ` } @@ -77,71 +67,51 @@ type publicreportNuisanceR struct { func buildPublicreportNuisanceColumns(alias string) publicreportNuisanceColumns { return publicreportNuisanceColumns{ ColumnsExpr: expr.NewColumnsExpr( - "id", "additional_info", "created", "duration", "email", "inspection_type", "source_location", "preferred_date_range", "preferred_time", "request_call", "severity", "source_container", "source_description", "source_roof", "source_stagnant", "time_of_day_day", "time_of_day_early", "time_of_day_evening", "time_of_day_night", "public_id", "reporter_address", "reporter_email", "reporter_name", "reporter_phone", "address", "location", "status", "organization_id", + "id", "additional_info", "created", "duration", "source_location", "source_container", "source_description", "source_stagnant", "public_id", "reporter_address", "reporter_email", "reporter_name", "reporter_phone", "address", "location", "status", "organization_id", "source_gutter", ).WithParent("publicreport.nuisance"), - tableAlias: alias, - ID: psql.Quote(alias, "id"), - AdditionalInfo: psql.Quote(alias, "additional_info"), - Created: psql.Quote(alias, "created"), - Duration: psql.Quote(alias, "duration"), - Email: psql.Quote(alias, "email"), - InspectionType: psql.Quote(alias, "inspection_type"), - SourceLocation: psql.Quote(alias, "source_location"), - PreferredDateRange: psql.Quote(alias, "preferred_date_range"), - PreferredTime: psql.Quote(alias, "preferred_time"), - RequestCall: psql.Quote(alias, "request_call"), - Severity: psql.Quote(alias, "severity"), - SourceContainer: psql.Quote(alias, "source_container"), - SourceDescription: psql.Quote(alias, "source_description"), - SourceRoof: psql.Quote(alias, "source_roof"), - SourceStagnant: psql.Quote(alias, "source_stagnant"), - TimeOfDayDay: psql.Quote(alias, "time_of_day_day"), - TimeOfDayEarly: psql.Quote(alias, "time_of_day_early"), - TimeOfDayEvening: psql.Quote(alias, "time_of_day_evening"), - TimeOfDayNight: psql.Quote(alias, "time_of_day_night"), - PublicID: psql.Quote(alias, "public_id"), - ReporterAddress: psql.Quote(alias, "reporter_address"), - ReporterEmail: psql.Quote(alias, "reporter_email"), - ReporterName: psql.Quote(alias, "reporter_name"), - ReporterPhone: psql.Quote(alias, "reporter_phone"), - Address: psql.Quote(alias, "address"), - Location: psql.Quote(alias, "location"), - Status: psql.Quote(alias, "status"), - OrganizationID: psql.Quote(alias, "organization_id"), + tableAlias: alias, + ID: psql.Quote(alias, "id"), + AdditionalInfo: psql.Quote(alias, "additional_info"), + Created: psql.Quote(alias, "created"), + Duration: psql.Quote(alias, "duration"), + SourceLocation: psql.Quote(alias, "source_location"), + SourceContainer: psql.Quote(alias, "source_container"), + SourceDescription: psql.Quote(alias, "source_description"), + SourceStagnant: psql.Quote(alias, "source_stagnant"), + PublicID: psql.Quote(alias, "public_id"), + ReporterAddress: psql.Quote(alias, "reporter_address"), + ReporterEmail: psql.Quote(alias, "reporter_email"), + ReporterName: psql.Quote(alias, "reporter_name"), + ReporterPhone: psql.Quote(alias, "reporter_phone"), + Address: psql.Quote(alias, "address"), + Location: psql.Quote(alias, "location"), + Status: psql.Quote(alias, "status"), + OrganizationID: psql.Quote(alias, "organization_id"), + SourceGutter: psql.Quote(alias, "source_gutter"), } } type publicreportNuisanceColumns struct { expr.ColumnsExpr - tableAlias string - ID psql.Expression - AdditionalInfo psql.Expression - Created psql.Expression - Duration psql.Expression - Email psql.Expression - InspectionType psql.Expression - SourceLocation psql.Expression - PreferredDateRange psql.Expression - PreferredTime psql.Expression - RequestCall psql.Expression - Severity psql.Expression - SourceContainer psql.Expression - SourceDescription psql.Expression - SourceRoof psql.Expression - SourceStagnant psql.Expression - TimeOfDayDay psql.Expression - TimeOfDayEarly psql.Expression - TimeOfDayEvening psql.Expression - TimeOfDayNight psql.Expression - PublicID psql.Expression - ReporterAddress psql.Expression - ReporterEmail psql.Expression - ReporterName psql.Expression - ReporterPhone psql.Expression - Address psql.Expression - Location psql.Expression - Status psql.Expression - OrganizationID psql.Expression + tableAlias string + ID psql.Expression + AdditionalInfo psql.Expression + Created psql.Expression + Duration psql.Expression + SourceLocation psql.Expression + SourceContainer psql.Expression + SourceDescription psql.Expression + SourceStagnant psql.Expression + PublicID psql.Expression + ReporterAddress psql.Expression + ReporterEmail psql.Expression + ReporterName psql.Expression + ReporterPhone psql.Expression + Address psql.Expression + Location psql.Expression + Status psql.Expression + OrganizationID psql.Expression + SourceGutter psql.Expression } func (c publicreportNuisanceColumns) Alias() string { @@ -156,38 +126,28 @@ func (publicreportNuisanceColumns) AliasedAs(alias string) publicreportNuisanceC // All values are optional, and do not have to be set // Generated columns are not included type PublicreportNuisanceSetter struct { - ID omit.Val[int32] `db:"id,pk" ` - AdditionalInfo omit.Val[string] `db:"additional_info" ` - Created omit.Val[time.Time] `db:"created" ` - Duration omit.Val[enums.PublicreportNuisancedurationtype] `db:"duration" ` - Email omit.Val[string] `db:"email" ` - InspectionType omit.Val[enums.PublicreportNuisanceinspectiontype] `db:"inspection_type" ` - SourceLocation omit.Val[enums.PublicreportNuisancelocationtype] `db:"source_location" ` - PreferredDateRange omit.Val[enums.PublicreportNuisancepreferreddaterangetype] `db:"preferred_date_range" ` - PreferredTime omit.Val[enums.PublicreportNuisancepreferredtimetype] `db:"preferred_time" ` - RequestCall omit.Val[bool] `db:"request_call" ` - Severity omit.Val[int16] `db:"severity" ` - SourceContainer omit.Val[bool] `db:"source_container" ` - SourceDescription omit.Val[string] `db:"source_description" ` - SourceRoof omit.Val[bool] `db:"source_roof" ` - SourceStagnant omit.Val[bool] `db:"source_stagnant" ` - TimeOfDayDay omit.Val[bool] `db:"time_of_day_day" ` - TimeOfDayEarly omit.Val[bool] `db:"time_of_day_early" ` - TimeOfDayEvening omit.Val[bool] `db:"time_of_day_evening" ` - TimeOfDayNight omit.Val[bool] `db:"time_of_day_night" ` - PublicID omit.Val[string] `db:"public_id" ` - ReporterAddress omit.Val[string] `db:"reporter_address" ` - ReporterEmail omit.Val[string] `db:"reporter_email" ` - ReporterName omit.Val[string] `db:"reporter_name" ` - ReporterPhone omit.Val[string] `db:"reporter_phone" ` - Address omit.Val[string] `db:"address" ` - Location omitnull.Val[string] `db:"location" ` - Status omit.Val[enums.PublicreportReportstatustype] `db:"status" ` - OrganizationID omitnull.Val[int32] `db:"organization_id" ` + ID omit.Val[int32] `db:"id,pk" ` + AdditionalInfo omit.Val[string] `db:"additional_info" ` + Created omit.Val[time.Time] `db:"created" ` + Duration omit.Val[enums.PublicreportNuisancedurationtype] `db:"duration" ` + SourceLocation omit.Val[enums.PublicreportNuisancelocationtype] `db:"source_location" ` + SourceContainer omit.Val[bool] `db:"source_container" ` + SourceDescription omit.Val[string] `db:"source_description" ` + SourceStagnant omit.Val[bool] `db:"source_stagnant" ` + PublicID omit.Val[string] `db:"public_id" ` + ReporterAddress omit.Val[string] `db:"reporter_address" ` + ReporterEmail omit.Val[string] `db:"reporter_email" ` + ReporterName omit.Val[string] `db:"reporter_name" ` + ReporterPhone omit.Val[string] `db:"reporter_phone" ` + Address omit.Val[string] `db:"address" ` + Location omitnull.Val[string] `db:"location" ` + Status omit.Val[enums.PublicreportReportstatustype] `db:"status" ` + OrganizationID omitnull.Val[int32] `db:"organization_id" ` + SourceGutter omit.Val[bool] `db:"source_gutter" ` } func (s PublicreportNuisanceSetter) SetColumns() []string { - vals := make([]string, 0, 28) + vals := make([]string, 0, 18) if s.ID.IsValue() { vals = append(vals, "id") } @@ -200,51 +160,18 @@ func (s PublicreportNuisanceSetter) SetColumns() []string { if s.Duration.IsValue() { vals = append(vals, "duration") } - if s.Email.IsValue() { - vals = append(vals, "email") - } - if s.InspectionType.IsValue() { - vals = append(vals, "inspection_type") - } if s.SourceLocation.IsValue() { vals = append(vals, "source_location") } - if s.PreferredDateRange.IsValue() { - vals = append(vals, "preferred_date_range") - } - if s.PreferredTime.IsValue() { - vals = append(vals, "preferred_time") - } - if s.RequestCall.IsValue() { - vals = append(vals, "request_call") - } - if s.Severity.IsValue() { - vals = append(vals, "severity") - } if s.SourceContainer.IsValue() { vals = append(vals, "source_container") } if s.SourceDescription.IsValue() { vals = append(vals, "source_description") } - if s.SourceRoof.IsValue() { - vals = append(vals, "source_roof") - } if s.SourceStagnant.IsValue() { vals = append(vals, "source_stagnant") } - if s.TimeOfDayDay.IsValue() { - vals = append(vals, "time_of_day_day") - } - if s.TimeOfDayEarly.IsValue() { - vals = append(vals, "time_of_day_early") - } - if s.TimeOfDayEvening.IsValue() { - vals = append(vals, "time_of_day_evening") - } - if s.TimeOfDayNight.IsValue() { - vals = append(vals, "time_of_day_night") - } if s.PublicID.IsValue() { vals = append(vals, "public_id") } @@ -272,6 +199,9 @@ func (s PublicreportNuisanceSetter) SetColumns() []string { if !s.OrganizationID.IsUnset() { vals = append(vals, "organization_id") } + if s.SourceGutter.IsValue() { + vals = append(vals, "source_gutter") + } return vals } @@ -288,51 +218,18 @@ func (s PublicreportNuisanceSetter) Overwrite(t *PublicreportNuisance) { if s.Duration.IsValue() { t.Duration = s.Duration.MustGet() } - if s.Email.IsValue() { - t.Email = s.Email.MustGet() - } - if s.InspectionType.IsValue() { - t.InspectionType = s.InspectionType.MustGet() - } if s.SourceLocation.IsValue() { t.SourceLocation = s.SourceLocation.MustGet() } - if s.PreferredDateRange.IsValue() { - t.PreferredDateRange = s.PreferredDateRange.MustGet() - } - if s.PreferredTime.IsValue() { - t.PreferredTime = s.PreferredTime.MustGet() - } - if s.RequestCall.IsValue() { - t.RequestCall = s.RequestCall.MustGet() - } - if s.Severity.IsValue() { - t.Severity = s.Severity.MustGet() - } if s.SourceContainer.IsValue() { t.SourceContainer = s.SourceContainer.MustGet() } if s.SourceDescription.IsValue() { t.SourceDescription = s.SourceDescription.MustGet() } - if s.SourceRoof.IsValue() { - t.SourceRoof = s.SourceRoof.MustGet() - } if s.SourceStagnant.IsValue() { t.SourceStagnant = s.SourceStagnant.MustGet() } - if s.TimeOfDayDay.IsValue() { - t.TimeOfDayDay = s.TimeOfDayDay.MustGet() - } - if s.TimeOfDayEarly.IsValue() { - t.TimeOfDayEarly = s.TimeOfDayEarly.MustGet() - } - if s.TimeOfDayEvening.IsValue() { - t.TimeOfDayEvening = s.TimeOfDayEvening.MustGet() - } - if s.TimeOfDayNight.IsValue() { - t.TimeOfDayNight = s.TimeOfDayNight.MustGet() - } if s.PublicID.IsValue() { t.PublicID = s.PublicID.MustGet() } @@ -360,6 +257,9 @@ func (s PublicreportNuisanceSetter) Overwrite(t *PublicreportNuisance) { if !s.OrganizationID.IsUnset() { t.OrganizationID = s.OrganizationID.MustGetNull() } + if s.SourceGutter.IsValue() { + t.SourceGutter = s.SourceGutter.MustGet() + } } func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) { @@ -368,7 +268,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, 28) + vals := make([]bob.Expression, 18) if s.ID.IsValue() { vals[0] = psql.Arg(s.ID.MustGet()) } else { @@ -393,150 +293,90 @@ func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) { vals[3] = psql.Raw("DEFAULT") } - if s.Email.IsValue() { - vals[4] = psql.Arg(s.Email.MustGet()) + if s.SourceLocation.IsValue() { + vals[4] = psql.Arg(s.SourceLocation.MustGet()) } else { vals[4] = psql.Raw("DEFAULT") } - if s.InspectionType.IsValue() { - vals[5] = psql.Arg(s.InspectionType.MustGet()) + if s.SourceContainer.IsValue() { + vals[5] = psql.Arg(s.SourceContainer.MustGet()) } else { vals[5] = psql.Raw("DEFAULT") } - if s.SourceLocation.IsValue() { - vals[6] = psql.Arg(s.SourceLocation.MustGet()) + if s.SourceDescription.IsValue() { + vals[6] = psql.Arg(s.SourceDescription.MustGet()) } else { vals[6] = psql.Raw("DEFAULT") } - if s.PreferredDateRange.IsValue() { - vals[7] = psql.Arg(s.PreferredDateRange.MustGet()) + if s.SourceStagnant.IsValue() { + vals[7] = psql.Arg(s.SourceStagnant.MustGet()) } else { vals[7] = psql.Raw("DEFAULT") } - if s.PreferredTime.IsValue() { - vals[8] = psql.Arg(s.PreferredTime.MustGet()) + if s.PublicID.IsValue() { + vals[8] = psql.Arg(s.PublicID.MustGet()) } else { vals[8] = psql.Raw("DEFAULT") } - if s.RequestCall.IsValue() { - vals[9] = psql.Arg(s.RequestCall.MustGet()) + if s.ReporterAddress.IsValue() { + vals[9] = psql.Arg(s.ReporterAddress.MustGet()) } else { vals[9] = psql.Raw("DEFAULT") } - if s.Severity.IsValue() { - vals[10] = psql.Arg(s.Severity.MustGet()) + if s.ReporterEmail.IsValue() { + vals[10] = psql.Arg(s.ReporterEmail.MustGet()) } else { vals[10] = psql.Raw("DEFAULT") } - if s.SourceContainer.IsValue() { - vals[11] = psql.Arg(s.SourceContainer.MustGet()) + if s.ReporterName.IsValue() { + vals[11] = psql.Arg(s.ReporterName.MustGet()) } else { vals[11] = psql.Raw("DEFAULT") } - if s.SourceDescription.IsValue() { - vals[12] = psql.Arg(s.SourceDescription.MustGet()) + if s.ReporterPhone.IsValue() { + vals[12] = psql.Arg(s.ReporterPhone.MustGet()) } else { vals[12] = psql.Raw("DEFAULT") } - if s.SourceRoof.IsValue() { - vals[13] = psql.Arg(s.SourceRoof.MustGet()) + if s.Address.IsValue() { + vals[13] = psql.Arg(s.Address.MustGet()) } else { vals[13] = psql.Raw("DEFAULT") } - if s.SourceStagnant.IsValue() { - vals[14] = psql.Arg(s.SourceStagnant.MustGet()) + if !s.Location.IsUnset() { + vals[14] = psql.Arg(s.Location.MustGetNull()) } else { vals[14] = psql.Raw("DEFAULT") } - if s.TimeOfDayDay.IsValue() { - vals[15] = psql.Arg(s.TimeOfDayDay.MustGet()) + if s.Status.IsValue() { + vals[15] = psql.Arg(s.Status.MustGet()) } else { vals[15] = psql.Raw("DEFAULT") } - if s.TimeOfDayEarly.IsValue() { - vals[16] = psql.Arg(s.TimeOfDayEarly.MustGet()) + if !s.OrganizationID.IsUnset() { + vals[16] = psql.Arg(s.OrganizationID.MustGetNull()) } else { vals[16] = psql.Raw("DEFAULT") } - if s.TimeOfDayEvening.IsValue() { - vals[17] = psql.Arg(s.TimeOfDayEvening.MustGet()) + if s.SourceGutter.IsValue() { + vals[17] = psql.Arg(s.SourceGutter.MustGet()) } else { vals[17] = psql.Raw("DEFAULT") } - if s.TimeOfDayNight.IsValue() { - vals[18] = psql.Arg(s.TimeOfDayNight.MustGet()) - } else { - vals[18] = psql.Raw("DEFAULT") - } - - if s.PublicID.IsValue() { - vals[19] = psql.Arg(s.PublicID.MustGet()) - } else { - vals[19] = psql.Raw("DEFAULT") - } - - if s.ReporterAddress.IsValue() { - vals[20] = psql.Arg(s.ReporterAddress.MustGet()) - } else { - vals[20] = psql.Raw("DEFAULT") - } - - if s.ReporterEmail.IsValue() { - vals[21] = psql.Arg(s.ReporterEmail.MustGet()) - } else { - vals[21] = psql.Raw("DEFAULT") - } - - if s.ReporterName.IsValue() { - vals[22] = psql.Arg(s.ReporterName.MustGet()) - } else { - vals[22] = psql.Raw("DEFAULT") - } - - if s.ReporterPhone.IsValue() { - vals[23] = psql.Arg(s.ReporterPhone.MustGet()) - } else { - vals[23] = psql.Raw("DEFAULT") - } - - if s.Address.IsValue() { - vals[24] = psql.Arg(s.Address.MustGet()) - } else { - vals[24] = psql.Raw("DEFAULT") - } - - if !s.Location.IsUnset() { - vals[25] = psql.Arg(s.Location.MustGetNull()) - } else { - vals[25] = psql.Raw("DEFAULT") - } - - if s.Status.IsValue() { - vals[26] = psql.Arg(s.Status.MustGet()) - } else { - vals[26] = psql.Raw("DEFAULT") - } - - if !s.OrganizationID.IsUnset() { - vals[27] = psql.Arg(s.OrganizationID.MustGetNull()) - } else { - vals[27] = psql.Raw("DEFAULT") - } - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") })) } @@ -546,7 +386,7 @@ func (s PublicreportNuisanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { } func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 28) + exprs := make([]bob.Expression, 0, 18) if s.ID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ @@ -576,20 +416,6 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi }}) } - if s.Email.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "email")...), - psql.Arg(s.Email), - }}) - } - - if s.InspectionType.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "inspection_type")...), - psql.Arg(s.InspectionType), - }}) - } - if s.SourceLocation.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "source_location")...), @@ -597,34 +423,6 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi }}) } - if s.PreferredDateRange.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "preferred_date_range")...), - psql.Arg(s.PreferredDateRange), - }}) - } - - if s.PreferredTime.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "preferred_time")...), - psql.Arg(s.PreferredTime), - }}) - } - - if s.RequestCall.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "request_call")...), - psql.Arg(s.RequestCall), - }}) - } - - if s.Severity.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "severity")...), - psql.Arg(s.Severity), - }}) - } - if s.SourceContainer.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "source_container")...), @@ -639,13 +437,6 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi }}) } - if s.SourceRoof.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "source_roof")...), - psql.Arg(s.SourceRoof), - }}) - } - if s.SourceStagnant.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "source_stagnant")...), @@ -653,34 +444,6 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi }}) } - if s.TimeOfDayDay.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "time_of_day_day")...), - psql.Arg(s.TimeOfDayDay), - }}) - } - - if s.TimeOfDayEarly.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "time_of_day_early")...), - psql.Arg(s.TimeOfDayEarly), - }}) - } - - if s.TimeOfDayEvening.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "time_of_day_evening")...), - psql.Arg(s.TimeOfDayEvening), - }}) - } - - if s.TimeOfDayNight.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "time_of_day_night")...), - psql.Arg(s.TimeOfDayNight), - }}) - } - if s.PublicID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ psql.Quote(append(prefix, "public_id")...), @@ -744,6 +507,13 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi }}) } + if s.SourceGutter.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "source_gutter")...), + psql.Arg(s.SourceGutter), + }}) + } + return exprs } @@ -1043,34 +813,24 @@ func (publicreportNuisance0 *PublicreportNuisance) AttachOrganization(ctx contex } type publicreportNuisanceWhere[Q psql.Filterable] struct { - ID psql.WhereMod[Q, int32] - AdditionalInfo psql.WhereMod[Q, string] - Created psql.WhereMod[Q, time.Time] - Duration psql.WhereMod[Q, enums.PublicreportNuisancedurationtype] - Email psql.WhereMod[Q, string] - InspectionType psql.WhereMod[Q, enums.PublicreportNuisanceinspectiontype] - SourceLocation psql.WhereMod[Q, enums.PublicreportNuisancelocationtype] - PreferredDateRange psql.WhereMod[Q, enums.PublicreportNuisancepreferreddaterangetype] - PreferredTime psql.WhereMod[Q, enums.PublicreportNuisancepreferredtimetype] - RequestCall psql.WhereMod[Q, bool] - Severity psql.WhereMod[Q, int16] - SourceContainer psql.WhereMod[Q, bool] - SourceDescription psql.WhereMod[Q, string] - SourceRoof psql.WhereMod[Q, bool] - SourceStagnant psql.WhereMod[Q, bool] - TimeOfDayDay psql.WhereMod[Q, bool] - TimeOfDayEarly psql.WhereMod[Q, bool] - TimeOfDayEvening psql.WhereMod[Q, bool] - TimeOfDayNight psql.WhereMod[Q, bool] - PublicID psql.WhereMod[Q, string] - ReporterAddress psql.WhereMod[Q, string] - ReporterEmail psql.WhereMod[Q, string] - ReporterName psql.WhereMod[Q, string] - ReporterPhone psql.WhereMod[Q, string] - Address psql.WhereMod[Q, string] - Location psql.WhereNullMod[Q, string] - Status psql.WhereMod[Q, enums.PublicreportReportstatustype] - OrganizationID psql.WhereNullMod[Q, int32] + ID psql.WhereMod[Q, int32] + AdditionalInfo psql.WhereMod[Q, string] + Created psql.WhereMod[Q, time.Time] + Duration psql.WhereMod[Q, enums.PublicreportNuisancedurationtype] + SourceLocation psql.WhereMod[Q, enums.PublicreportNuisancelocationtype] + SourceContainer psql.WhereMod[Q, bool] + SourceDescription psql.WhereMod[Q, string] + SourceStagnant psql.WhereMod[Q, bool] + PublicID psql.WhereMod[Q, string] + ReporterAddress psql.WhereMod[Q, string] + ReporterEmail psql.WhereMod[Q, string] + ReporterName psql.WhereMod[Q, string] + ReporterPhone psql.WhereMod[Q, string] + Address psql.WhereMod[Q, string] + Location psql.WhereNullMod[Q, string] + Status psql.WhereMod[Q, enums.PublicreportReportstatustype] + OrganizationID psql.WhereNullMod[Q, int32] + SourceGutter psql.WhereMod[Q, bool] } func (publicreportNuisanceWhere[Q]) AliasedAs(alias string) publicreportNuisanceWhere[Q] { @@ -1079,34 +839,24 @@ func (publicreportNuisanceWhere[Q]) AliasedAs(alias string) publicreportNuisance func buildPublicreportNuisanceWhere[Q psql.Filterable](cols publicreportNuisanceColumns) publicreportNuisanceWhere[Q] { return publicreportNuisanceWhere[Q]{ - ID: psql.Where[Q, int32](cols.ID), - AdditionalInfo: psql.Where[Q, string](cols.AdditionalInfo), - Created: psql.Where[Q, time.Time](cols.Created), - Duration: psql.Where[Q, enums.PublicreportNuisancedurationtype](cols.Duration), - Email: psql.Where[Q, string](cols.Email), - InspectionType: psql.Where[Q, enums.PublicreportNuisanceinspectiontype](cols.InspectionType), - SourceLocation: psql.Where[Q, enums.PublicreportNuisancelocationtype](cols.SourceLocation), - PreferredDateRange: psql.Where[Q, enums.PublicreportNuisancepreferreddaterangetype](cols.PreferredDateRange), - PreferredTime: psql.Where[Q, enums.PublicreportNuisancepreferredtimetype](cols.PreferredTime), - RequestCall: psql.Where[Q, bool](cols.RequestCall), - Severity: psql.Where[Q, int16](cols.Severity), - SourceContainer: psql.Where[Q, bool](cols.SourceContainer), - SourceDescription: psql.Where[Q, string](cols.SourceDescription), - SourceRoof: psql.Where[Q, bool](cols.SourceRoof), - SourceStagnant: psql.Where[Q, bool](cols.SourceStagnant), - TimeOfDayDay: psql.Where[Q, bool](cols.TimeOfDayDay), - TimeOfDayEarly: psql.Where[Q, bool](cols.TimeOfDayEarly), - TimeOfDayEvening: psql.Where[Q, bool](cols.TimeOfDayEvening), - TimeOfDayNight: psql.Where[Q, bool](cols.TimeOfDayNight), - PublicID: psql.Where[Q, string](cols.PublicID), - ReporterAddress: psql.Where[Q, string](cols.ReporterAddress), - ReporterEmail: psql.Where[Q, string](cols.ReporterEmail), - ReporterName: psql.Where[Q, string](cols.ReporterName), - ReporterPhone: psql.Where[Q, string](cols.ReporterPhone), - Address: psql.Where[Q, string](cols.Address), - Location: psql.WhereNull[Q, string](cols.Location), - Status: psql.Where[Q, enums.PublicreportReportstatustype](cols.Status), - OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + ID: psql.Where[Q, int32](cols.ID), + AdditionalInfo: psql.Where[Q, string](cols.AdditionalInfo), + Created: psql.Where[Q, time.Time](cols.Created), + Duration: psql.Where[Q, enums.PublicreportNuisancedurationtype](cols.Duration), + SourceLocation: psql.Where[Q, enums.PublicreportNuisancelocationtype](cols.SourceLocation), + SourceContainer: psql.Where[Q, bool](cols.SourceContainer), + SourceDescription: psql.Where[Q, string](cols.SourceDescription), + SourceStagnant: psql.Where[Q, bool](cols.SourceStagnant), + PublicID: psql.Where[Q, string](cols.PublicID), + ReporterAddress: psql.Where[Q, string](cols.ReporterAddress), + ReporterEmail: psql.Where[Q, string](cols.ReporterEmail), + ReporterName: psql.Where[Q, string](cols.ReporterName), + ReporterPhone: psql.Where[Q, string](cols.ReporterPhone), + Address: psql.Where[Q, string](cols.Address), + Location: psql.WhereNull[Q, string](cols.Location), + Status: psql.Where[Q, enums.PublicreportReportstatustype](cols.Status), + OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID), + SourceGutter: psql.Where[Q, bool](cols.SourceGutter), } } diff --git a/rmo/nuisance.go b/rmo/nuisance.go index 3a66d23c..aa26ea4a 100644 --- a/rmo/nuisance.go +++ b/rmo/nuisance.go @@ -3,7 +3,6 @@ package rmo import ( "fmt" "net/http" - "strconv" "time" "github.com/Gleipnir-Technology/nidus-sync/config" @@ -57,16 +56,9 @@ func postNuisance(w http.ResponseWriter, r *http.Request) { respondError(w, "Failed to parse form", err, http.StatusBadRequest) return } - tod_early := boolFromForm(r, "tod-early") - tod_day := boolFromForm(r, "tod-day") - tod_evening := boolFromForm(r, "tod-evening") - tod_night := boolFromForm(r, "tod-night") - source_stagnant := boolFromForm(r, "source-stagnant") source_container := boolFromForm(r, "source-container") - source_roof := boolFromForm(r, "source-container") - - request_call := boolFromForm(r, "request-call") + source_gutters := boolFromForm(r, "source-gutters") duration_str := postFormValueOrNone(r, "duration") var duration enums.PublicreportNuisancedurationtype @@ -76,14 +68,6 @@ func postNuisance(w http.ResponseWriter, r *http.Request) { return } - inspection_type_str := postFormValueOrNone(r, "inspection-type") - var inspection_type enums.PublicreportNuisanceinspectiontype - err = inspection_type.Scan(inspection_type_str) - if err != nil { - respondError(w, fmt.Sprintf("Failed to interpret 'inspection-type' of '%s'", inspection_type_str), err, http.StatusBadRequest) - return - } - source_location_str := postFormValueOrNone(r, "source-location") var source_location enums.PublicreportNuisancelocationtype err = source_location.Scan(source_location_str) @@ -91,33 +75,8 @@ func postNuisance(w http.ResponseWriter, r *http.Request) { respondError(w, fmt.Sprintf("Failed to interpret 'source-location' of '%s'", source_location_str), err, http.StatusBadRequest) return } - preferred_date_range_str := postFormValueOrNone(r, "preferred-date-range") - var preferred_date_range enums.PublicreportNuisancepreferreddaterangetype - err = preferred_date_range.Scan(preferred_date_range_str) - if err != nil { - respondError(w, fmt.Sprintf("Failed to interpret 'preferred-date-range' of '%s'", preferred_date_range_str), err, http.StatusBadRequest) - return - } - preferred_time_str := postFormValueOrNone(r, "preferred-time") - var preferred_time enums.PublicreportNuisancepreferredtimetype - err = preferred_time.Scan(preferred_time_str) - if err != nil { - respondError(w, fmt.Sprintf("Failed to interpret 'preferred-time' of '%s'", preferred_time_str), err, http.StatusBadRequest) - return - } - - severity_str := r.PostFormValue("severity") - severity, err := strconv.ParseInt(severity_str, 10, 16) - if err != nil { - respondError(w, fmt.Sprintf("Failed to interpret 'severity' of '%s' as an integer", severity_str), err, http.StatusBadRequest) - return - } source_description := r.PostFormValue("source-description") - address := r.PostFormValue("address") - name := r.PostFormValue("name") - phone := r.PostFormValue("phone") - email := r.PostFormValue("email") additional_info := r.PostFormValue("additional-info") public_id, err := GenerateReportID() @@ -126,33 +85,22 @@ func postNuisance(w http.ResponseWriter, r *http.Request) { return } - log.Info().Str("address", address).Str("name", name).Msg("Got report") setter := models.PublicreportNuisanceSetter{ - AdditionalInfo: omit.From(additional_info), - Created: omit.From(time.Now()), - Duration: omit.From(duration), - Email: omit.From(email), - InspectionType: omit.From(inspection_type), - Location: omitnull.FromPtr[string](nil), - PreferredDateRange: omit.From(preferred_date_range), - PreferredTime: omit.From(preferred_time), - PublicID: omit.From(public_id), - RequestCall: omit.From(request_call), - Severity: omit.From(int16(severity)), - SourceContainer: omit.From(source_container), - SourceDescription: omit.From(source_description), - SourceRoof: omit.From(source_roof), - SourceLocation: omit.From(source_location), - SourceStagnant: omit.From(source_stagnant), - Status: omit.From(enums.PublicreportReportstatustypeReported), - TimeOfDayDay: omit.From(tod_day), - TimeOfDayEarly: omit.From(tod_early), - TimeOfDayEvening: omit.From(tod_evening), - TimeOfDayNight: omit.From(tod_night), - ReporterAddress: omit.From(address), - ReporterEmail: omit.From(email), - ReporterName: omit.From(name), - ReporterPhone: omit.From(phone), + AdditionalInfo: omit.From(additional_info), + Created: omit.From(time.Now()), + Duration: omit.From(duration), + Location: omitnull.FromPtr[string](nil), + PublicID: omit.From(public_id), + SourceContainer: omit.From(source_container), + SourceDescription: omit.From(source_description), + SourceGutter: omit.From(source_gutters), + SourceLocation: omit.From(source_location), + SourceStagnant: omit.From(source_stagnant), + Status: omit.From(enums.PublicreportReportstatustypeReported), + ReporterAddress: omit.FromPtr[string](nil), + ReporterEmail: omit.FromPtr[string](nil), + ReporterName: omit.FromPtr[string](nil), + ReporterPhone: omit.FromPtr[string](nil), } nuisance, err := models.PublicreportNuisances.Insert(&setter).One(r.Context(), db.PGInstance.BobDB) if err != nil { diff --git a/rmo/template/nuisance.html b/rmo/template/nuisance.html index ced0c64a..1b37692e 100644 --- a/rmo/template/nuisance.html +++ b/rmo/template/nuisance.html @@ -148,7 +148,7 @@ document.addEventListener('DOMContentLoaded', function() {
- +