Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B-21337-MAIN Bulk assignment data fetch setup #14371

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pkg/factory/move_factory.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package factory

import (
"fmt"
"log"
"time"

Expand Down Expand Up @@ -71,6 +72,8 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode
if closeoutOfficeResult != nil {
move.CloseoutOffice = &closeoutOffice
move.CloseoutOfficeID = &closeoutOffice.ID
move.CounselingOffice = &closeoutOffice
move.CounselingOfficeID = &closeoutOffice.ID
paulstonebraker marked this conversation as resolved.
Show resolved Hide resolved
}

// Overwrite values with those from assertions
Expand Down Expand Up @@ -181,9 +184,36 @@ func BuildMoveWithPPMShipment(db *pop.Connection, customs []Customization, trait
if db != nil {
mustSave(db, &move)
}
fmt.Println("move in factory")
fmt.Println(move.ID)
paulstonebraker marked this conversation as resolved.
Show resolved Hide resolved

return move
}
func BuildAssignedMoveWithPPMShipment(db *pop.Connection, customs []Customization, traits []Trait) models.Move {
move := BuildMove(db, customs, traits)

mtoShipment := buildMTOShipmentWithBuildType(db, customs, traits, mtoShipmentPPM)
mtoShipment.MoveTaskOrder = move
mtoShipment.MoveTaskOrderID = move.ID

ppmShipment := BuildPPMShipment(db, customs, traits)
ppmShipment.ShipmentID = mtoShipment.ID

mtoShipment.PPMShipment = &ppmShipment
mtoShipment.ShipmentType = models.MTOShipmentTypePPM
move.MTOShipments = append(move.MTOShipments, mtoShipment)

officeUser := BuildOfficeUser(db, customs, traits)
move.SCAssignedUser = &officeUser
move.SCAssignedID = &officeUser.ID

if db != nil {
mustSave(db, &move)
}
fmt.Println("move")
fmt.Println(move.SCAssignedUser)
return move
}

// ------------------------
// TRAITS
Expand Down
33 changes: 24 additions & 9 deletions pkg/factory/office_user_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,34 @@ func BuildOfficeUser(db *pop.Connection, customs []Customization, traits []Trait
// Find/create the user model
user := BuildUserAndUsersRoles(db, customs, nil)

var closeoutOffice models.TransportationOffice
tempCloseoutOfficeCustoms := customs
closeoutOfficeResult := findValidCustomization(customs, TransportationOffices.CloseoutOffice)
if closeoutOfficeResult != nil {
tempCloseoutOfficeCustoms = convertCustomizationInList(tempCloseoutOfficeCustoms, TransportationOffices.CloseoutOffice, TransportationOffice)
closeoutOffice = BuildTransportationOffice(db, tempCloseoutOfficeCustoms, nil)
}
// Find/create the TransportationOffice model
transportationOffice := BuildTransportationOffice(db, customs, nil)
basicTransportationOffice := BuildTransportationOffice(db, customs, nil)

// create officeuser
officeUser := models.OfficeUser{
UserID: &user.ID,
User: user,
FirstName: "Leo",
LastName: "Spaceman",
Email: "[email protected]",
Telephone: "415-555-1212",
TransportationOffice: transportationOffice,
TransportationOfficeID: transportationOffice.ID,
UserID: &user.ID,
User: user,
FirstName: "Leo",
LastName: "Spaceman",
Email: "[email protected]",
Telephone: "415-555-1212",
// TransportationOffice: transportationOffice,
// TransportationOfficeID: transportationOffice.ID,
}

if closeoutOfficeResult != nil {
officeUser.TransportationOffice = closeoutOffice
officeUser.TransportationOfficeID = closeoutOffice.ID
} else {
officeUser.TransportationOffice = basicTransportationOffice
officeUser.TransportationOfficeID = basicTransportationOffice.ID
}
// Overwrite values with those from assertions
testdatagen.MergeModels(&officeUser, cOfficeUser)
Expand Down
2 changes: 2 additions & 0 deletions pkg/factory/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,15 @@ type transportationOfficeGroup struct {
OriginDutyLocation CustomType
NewDutyLocation CustomType
CloseoutOffice CustomType
CounselingOffice CustomType
}

// TransportationOffices is the struct to access the fields externally
var TransportationOffices = transportationOfficeGroup{
OriginDutyLocation: "OriginDutyLocationTransportationOffice",
NewDutyLocation: "NewDutyLocationTransportationOffice",
CloseoutOffice: "CloseoutOffice",
CounselingOffice: "CounselingOffice",
}

// uploadGroup is a grouping of all the upload related fields
Expand Down
5 changes: 5 additions & 0 deletions pkg/gen/ghcapi/configure_mymove.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ func configureAPI(api *ghcoperations.MymoveAPI) http.Handler {
return middleware.NotImplemented("operation re_service_items.GetAllReServiceItems has not yet been implemented")
})
}
if api.QueuesGetBulkAssignmentDataHandler == nil {
api.QueuesGetBulkAssignmentDataHandler = queues.GetBulkAssignmentDataHandlerFunc(func(params queues.GetBulkAssignmentDataParams) middleware.Responder {
return middleware.NotImplemented("operation queues.GetBulkAssignmentData has not yet been implemented")
})
}
if api.CustomerGetCustomerHandler == nil {
api.CustomerGetCustomerHandler = customer.GetCustomerHandlerFunc(func(params customer.GetCustomerParams) middleware.Responder {
return middleware.NotImplemented("operation customer.GetCustomer has not yet been implemented")
Expand Down
153 changes: 153 additions & 0 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/gen/ghcapi/ghcoperations/mymove_api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading