Skip to content

Commit

Permalink
Merge pull request #14455 from transcom/B-21169
Browse files Browse the repository at this point in the history
B-21168/B-21169 City Finder
  • Loading branch information
pambecker authored Dec 24, 2024
2 parents db501c5 + a581a0c commit d7d715b
Show file tree
Hide file tree
Showing 182 changed files with 7,032 additions and 2,912 deletions.
8 changes: 4 additions & 4 deletions pkg/factory/address_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func BuildAddress(db *pop.Connection, customs []Customization, traits []Trait) m
City: "Beverly Hills",
State: "CA",
PostalCode: "90210",
County: "LOS ANGELES",
County: models.StringPointer("LOS ANGELES"),
IsOconus: models.BoolPointer(false),
}

Expand Down Expand Up @@ -62,14 +62,14 @@ func BuildAddress(db *pop.Connection, customs []Customization, traits []Trait) m
county, err := models.FindCountyByZipCode(db, address.PostalCode)
if err != nil {
// A zip code that is not being tracked has been entered
address.County = "does not exist"
address.County = models.StringPointer("does not exist")
} else {
// The zip code successfully found a county
address.County = county
}
} else if db == nil && address.PostalCode != "90210" {
// If no db supplied, mark that
address.County = "db nil when created"
address.County = models.StringPointer("db nil when created")
}

// If db is false, it's a stub. No need to create in database.
Expand Down Expand Up @@ -98,7 +98,7 @@ func BuildMinimalAddress(db *pop.Connection, customs []Customization, traits []T
City: "Fort Gorden",
State: "GA",
PostalCode: "30813",
County: "RICHMOND",
County: models.StringPointer("RICHMOND"),
IsOconus: models.BoolPointer(false),
}

Expand Down
14 changes: 7 additions & 7 deletions pkg/factory/address_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (suite *FactorySuite) TestBuildAddress() {
customCity := "Modesto"
customState := "ID"
customPostalCode := "83725"
customCounty := "ADA"
customCounty := models.StringPointer("ADA")
suite.Run("Successful creation of default address", func() {
// Under test: BuildAddress
// Mocked: None
Expand All @@ -39,7 +39,7 @@ func (suite *FactorySuite) TestBuildAddress() {
suite.Equal(defaultState, address.State)
suite.Equal(defaultPostalCode, address.PostalCode)
suite.Equal(country.ID, *address.CountryId)
suite.Equal(defaultCounty, address.County)
suite.Equal(defaultCounty, *address.County)
})

suite.Run("Successful creation of an address with customization", func() {
Expand Down Expand Up @@ -100,7 +100,7 @@ func (suite *FactorySuite) TestBuildAddress() {
suite.Equal("CA", address.State)
suite.Equal("94535", address.PostalCode)
suite.Equal(country.ID, *address.CountryId)
suite.Equal("SOLANO", address.County)
suite.Equal("SOLANO", *address.County)
})

suite.Run("Successful creation of address with both", func() {
Expand Down Expand Up @@ -130,7 +130,7 @@ func (suite *FactorySuite) TestBuildAddress() {
suite.Equal("IA", address.State)
suite.Equal("50309", address.PostalCode)
suite.Equal(country.ID, *address.CountryId)
suite.Equal("POLK", address.County)
suite.Equal("POLK", *address.County)
})

suite.Run("Successful creation of stubbed address", func() {
Expand Down Expand Up @@ -159,7 +159,7 @@ func (suite *FactorySuite) TestBuildAddress() {
suite.Equal("Houston", address.City)
suite.Equal("TX", address.State)
suite.Equal("77083", address.PostalCode)
suite.Equal("db nil when created", address.County)
suite.Equal("db nil when created", *address.County)

// Count how many addresses are in the DB, no new addresses should have been created
count, err := suite.DB().Count(&models.Address{})
Expand All @@ -186,7 +186,7 @@ func (suite *FactorySuite) TestBuildAddress() {
City: customCity,
State: customState,
PostalCode: customPostalCode,
County: "County",
County: customCounty,
IsOconus: models.BoolPointer(false),
},
LinkOnly: true,
Expand All @@ -204,7 +204,7 @@ func (suite *FactorySuite) TestBuildAddress() {
suite.Equal(customCity, address.City)
suite.Equal(customState, address.State)
suite.Equal(customPostalCode, address.PostalCode)
suite.Equal("County", address.County)
suite.Equal(customCounty, address.County)
})
}

Expand Down
18 changes: 2 additions & 16 deletions pkg/factory/ppm_shipment_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,14 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
City: "Des Moines",
State: "IA",
PostalCode: "50309",
County: "POLK",
},
SecondaryPickupAddress: &models.Address{
StreetAddress1: "123 Main Street",
City: "Des Moines",
State: "IA",
PostalCode: "50309",
County: "POLK",
County: models.StringPointer("POLK"),
},
DestinationAddress: &models.Address{
StreetAddress1: "123 New Street",
City: "Fort Eisenhower",
State: "GA",
PostalCode: "30813",
County: "COLUMBIA",
},
SecondaryDestinationAddress: &models.Address{
StreetAddress1: "1234 Main Street",
City: "Fort Eisenhower",
State: "GA",
PostalCode: "30813",
County: "COLUMBIA",
County: models.StringPointer("COLUMBIA"),
},
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/gen/ghcapi/configure_mymove.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/go-openapi/runtime/middleware"

"github.com/transcom/mymove/pkg/gen/ghcapi/ghcoperations"
"github.com/transcom/mymove/pkg/gen/ghcapi/ghcoperations/addresses"
"github.com/transcom/mymove/pkg/gen/ghcapi/ghcoperations/application_parameters"
"github.com/transcom/mymove/pkg/gen/ghcapi/ghcoperations/calendar"
"github.com/transcom/mymove/pkg/gen/ghcapi/ghcoperations/customer"
Expand Down Expand Up @@ -246,6 +247,11 @@ func configureAPI(api *ghcoperations.MymoveAPI) http.Handler {
return middleware.NotImplemented("operation evaluation_reports.GetEvaluationReport has not yet been implemented")
})
}
if api.AddressesGetLocationByZipCityStateHandler == nil {
api.AddressesGetLocationByZipCityStateHandler = addresses.GetLocationByZipCityStateHandlerFunc(func(params addresses.GetLocationByZipCityStateParams) middleware.Responder {
return middleware.NotImplemented("operation addresses.GetLocationByZipCityState has not yet been implemented")
})
}
if api.MtoServiceItemGetMTOServiceItemHandler == nil {
api.MtoServiceItemGetMTOServiceItemHandler = mto_service_item.GetMTOServiceItemHandlerFunc(func(params mto_service_item.GetMTOServiceItemParams) middleware.Responder {
return middleware.NotImplemented("operation mto_service_item.GetMTOServiceItem has not yet been implemented")
Expand Down
Loading

0 comments on commit d7d715b

Please sign in to comment.