diff --git a/pkg/gen/ghcapi/embedded_spec.go b/pkg/gen/ghcapi/embedded_spec.go index 37daf556d59..41a45c7339a 100644 --- a/pkg/gen/ghcapi/embedded_spec.go +++ b/pkg/gen/ghcapi/embedded_spec.go @@ -4130,7 +4130,7 @@ func init() { }, { "enum": [ - "lastName", + "customerName", "dodID", "emplid", "branch", @@ -4178,7 +4178,7 @@ func init() { { "type": "string", "description": "filters using a prefix match on the service member's last name", - "name": "lastName", + "name": "customerName", "in": "query" }, { @@ -4384,7 +4384,7 @@ func init() { }, { "enum": [ - "lastName", + "customerName", "dodID", "emplid", "branch", @@ -4423,7 +4423,7 @@ func init() { }, { "type": "string", - "name": "lastName", + "name": "customerName", "in": "query" }, { @@ -4527,7 +4527,7 @@ func init() { "parameters": [ { "enum": [ - "lastName", + "customerName", "locator", "submittedAt", "branch", @@ -4583,7 +4583,7 @@ func init() { }, { "type": "string", - "name": "lastName", + "name": "customerName", "in": "query" }, { @@ -19631,7 +19631,7 @@ func init() { }, { "enum": [ - "lastName", + "customerName", "dodID", "emplid", "branch", @@ -19679,7 +19679,7 @@ func init() { { "type": "string", "description": "filters using a prefix match on the service member's last name", - "name": "lastName", + "name": "customerName", "in": "query" }, { @@ -19897,7 +19897,7 @@ func init() { }, { "enum": [ - "lastName", + "customerName", "dodID", "emplid", "branch", @@ -19936,7 +19936,7 @@ func init() { }, { "type": "string", - "name": "lastName", + "name": "customerName", "in": "query" }, { @@ -20046,7 +20046,7 @@ func init() { "parameters": [ { "enum": [ - "lastName", + "customerName", "locator", "submittedAt", "branch", @@ -20102,7 +20102,7 @@ func init() { }, { "type": "string", - "name": "lastName", + "name": "customerName", "in": "query" }, { diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go index b3af0e4b808..4d51b99e7a2 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go @@ -50,19 +50,19 @@ type GetMovesQueueParams struct { /* In: query */ - DestinationDutyLocation *string + CustomerName *string /* In: query */ - DodID *string + DestinationDutyLocation *string /* In: query */ - Emplid *string + DodID *string /* In: query */ - LastName *string + Emplid *string /* In: query */ @@ -135,6 +135,11 @@ func (o *GetMovesQueueParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } + qCustomerName, qhkCustomerName, _ := qs.GetOK("customerName") + if err := o.bindCustomerName(qCustomerName, qhkCustomerName, route.Formats); err != nil { + res = append(res, err) + } + qDestinationDutyLocation, qhkDestinationDutyLocation, _ := qs.GetOK("destinationDutyLocation") if err := o.bindDestinationDutyLocation(qDestinationDutyLocation, qhkDestinationDutyLocation, route.Formats); err != nil { res = append(res, err) @@ -150,11 +155,6 @@ func (o *GetMovesQueueParams) BindRequest(r *http.Request, route *middleware.Mat res = append(res, err) } - qLastName, qhkLastName, _ := qs.GetOK("lastName") - if err := o.bindLastName(qLastName, qhkLastName, route.Formats); err != nil { - res = append(res, err) - } - qLocator, qhkLocator, _ := qs.GetOK("locator") if err := o.bindLocator(qLocator, qhkLocator, route.Formats); err != nil { res = append(res, err) @@ -283,8 +283,8 @@ func (o *GetMovesQueueParams) bindBranch(rawData []string, hasKey bool, formats return nil } -// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. -func (o *GetMovesQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindCustomerName binds and validates parameter CustomerName from query. +func (o *GetMovesQueueParams) bindCustomerName(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -296,13 +296,13 @@ func (o *GetMovesQueueParams) bindDestinationDutyLocation(rawData []string, hasK if raw == "" { // empty values pass all other validations return nil } - o.DestinationDutyLocation = &raw + o.CustomerName = &raw return nil } -// bindDodID binds and validates parameter DodID from query. -func (o *GetMovesQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. +func (o *GetMovesQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -314,13 +314,13 @@ func (o *GetMovesQueueParams) bindDodID(rawData []string, hasKey bool, formats s if raw == "" { // empty values pass all other validations return nil } - o.DodID = &raw + o.DestinationDutyLocation = &raw return nil } -// bindEmplid binds and validates parameter Emplid from query. -func (o *GetMovesQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDodID binds and validates parameter DodID from query. +func (o *GetMovesQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -332,13 +332,13 @@ func (o *GetMovesQueueParams) bindEmplid(rawData []string, hasKey bool, formats if raw == "" { // empty values pass all other validations return nil } - o.Emplid = &raw + o.DodID = &raw return nil } -// bindLastName binds and validates parameter LastName from query. -func (o *GetMovesQueueParams) bindLastName(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindEmplid binds and validates parameter Emplid from query. +func (o *GetMovesQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -350,7 +350,7 @@ func (o *GetMovesQueueParams) bindLastName(rawData []string, hasKey bool, format if raw == "" { // empty values pass all other validations return nil } - o.LastName = &raw + o.Emplid = &raw return nil } @@ -547,7 +547,7 @@ func (o *GetMovesQueueParams) bindSort(rawData []string, hasKey bool, formats st // validateSort carries on validations for parameter Sort func (o *GetMovesQueueParams) validateSort(formats strfmt.Registry) error { - if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"lastName", "dodID", "emplid", "branch", "locator", "status", "originDutyLocation", "destinationDutyLocation", "requestedMoveDate", "appearedInTooAt", "assignedTo"}, true); err != nil { + if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"customerName", "dodID", "emplid", "branch", "locator", "status", "originDutyLocation", "destinationDutyLocation", "requestedMoveDate", "appearedInTooAt", "assignedTo"}, true); err != nil { return err } diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_urlbuilder.go b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_urlbuilder.go index 0ead75ca533..cc634c8957a 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_urlbuilder.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_urlbuilder.go @@ -19,10 +19,10 @@ type GetMovesQueueURL struct { AppearedInTooAt *strfmt.DateTime AssignedTo *string Branch *string + CustomerName *string DestinationDutyLocation *string DodID *string Emplid *string - LastName *string Locator *string Order *string OrderType *string @@ -92,6 +92,14 @@ func (o *GetMovesQueueURL) Build() (*url.URL, error) { qs.Set("branch", branchQ) } + var customerNameQ string + if o.CustomerName != nil { + customerNameQ = *o.CustomerName + } + if customerNameQ != "" { + qs.Set("customerName", customerNameQ) + } + var destinationDutyLocationQ string if o.DestinationDutyLocation != nil { destinationDutyLocationQ = *o.DestinationDutyLocation @@ -116,14 +124,6 @@ func (o *GetMovesQueueURL) Build() (*url.URL, error) { qs.Set("emplid", emplidQ) } - var lastNameQ string - if o.LastName != nil { - lastNameQ = *o.LastName - } - if lastNameQ != "" { - qs.Set("lastName", lastNameQ) - } - var locatorQ string if o.Locator != nil { locatorQ = *o.Locator diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_parameters.go b/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_parameters.go index dd375958129..b3efa1c6efd 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_parameters.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_parameters.go @@ -41,19 +41,19 @@ type GetPaymentRequestsQueueParams struct { /* In: query */ - DestinationDutyLocation *string + CustomerName *string /* In: query */ - DodID *string + DestinationDutyLocation *string /* In: query */ - Emplid *string + DodID *string /* In: query */ - LastName *string + Emplid *string /* In: query */ @@ -114,6 +114,11 @@ func (o *GetPaymentRequestsQueueParams) BindRequest(r *http.Request, route *midd res = append(res, err) } + qCustomerName, qhkCustomerName, _ := qs.GetOK("customerName") + if err := o.bindCustomerName(qCustomerName, qhkCustomerName, route.Formats); err != nil { + res = append(res, err) + } + qDestinationDutyLocation, qhkDestinationDutyLocation, _ := qs.GetOK("destinationDutyLocation") if err := o.bindDestinationDutyLocation(qDestinationDutyLocation, qhkDestinationDutyLocation, route.Formats); err != nil { res = append(res, err) @@ -129,11 +134,6 @@ func (o *GetPaymentRequestsQueueParams) BindRequest(r *http.Request, route *midd res = append(res, err) } - qLastName, qhkLastName, _ := qs.GetOK("lastName") - if err := o.bindLastName(qLastName, qhkLastName, route.Formats); err != nil { - res = append(res, err) - } - qLocator, qhkLocator, _ := qs.GetOK("locator") if err := o.bindLocator(qLocator, qhkLocator, route.Formats); err != nil { res = append(res, err) @@ -207,8 +207,8 @@ func (o *GetPaymentRequestsQueueParams) bindBranch(rawData []string, hasKey bool return nil } -// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. -func (o *GetPaymentRequestsQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindCustomerName binds and validates parameter CustomerName from query. +func (o *GetPaymentRequestsQueueParams) bindCustomerName(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -220,13 +220,13 @@ func (o *GetPaymentRequestsQueueParams) bindDestinationDutyLocation(rawData []st if raw == "" { // empty values pass all other validations return nil } - o.DestinationDutyLocation = &raw + o.CustomerName = &raw return nil } -// bindDodID binds and validates parameter DodID from query. -func (o *GetPaymentRequestsQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. +func (o *GetPaymentRequestsQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -238,13 +238,13 @@ func (o *GetPaymentRequestsQueueParams) bindDodID(rawData []string, hasKey bool, if raw == "" { // empty values pass all other validations return nil } - o.DodID = &raw + o.DestinationDutyLocation = &raw return nil } -// bindEmplid binds and validates parameter Emplid from query. -func (o *GetPaymentRequestsQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDodID binds and validates parameter DodID from query. +func (o *GetPaymentRequestsQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -256,13 +256,13 @@ func (o *GetPaymentRequestsQueueParams) bindEmplid(rawData []string, hasKey bool if raw == "" { // empty values pass all other validations return nil } - o.Emplid = &raw + o.DodID = &raw return nil } -// bindLastName binds and validates parameter LastName from query. -func (o *GetPaymentRequestsQueueParams) bindLastName(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindEmplid binds and validates parameter Emplid from query. +func (o *GetPaymentRequestsQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -274,7 +274,7 @@ func (o *GetPaymentRequestsQueueParams) bindLastName(rawData []string, hasKey bo if raw == "" { // empty values pass all other validations return nil } - o.LastName = &raw + o.Emplid = &raw return nil } @@ -436,7 +436,7 @@ func (o *GetPaymentRequestsQueueParams) bindSort(rawData []string, hasKey bool, // validateSort carries on validations for parameter Sort func (o *GetPaymentRequestsQueueParams) validateSort(formats strfmt.Registry) error { - if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"lastName", "locator", "submittedAt", "branch", "status", "dodID", "emplid", "age", "originDutyLocation"}, true); err != nil { + if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"customerName", "locator", "submittedAt", "branch", "status", "dodID", "emplid", "age", "originDutyLocation"}, true); err != nil { return err } diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_urlbuilder.go b/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_urlbuilder.go index bf2dddde0bf..a1174073d38 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_urlbuilder.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_payment_requests_queue_urlbuilder.go @@ -17,10 +17,10 @@ import ( // GetPaymentRequestsQueueURL generates an URL for the get payment requests queue operation type GetPaymentRequestsQueueURL struct { Branch *string + CustomerName *string DestinationDutyLocation *string DodID *string Emplid *string - LastName *string Locator *string Order *string OrderType *string @@ -74,6 +74,14 @@ func (o *GetPaymentRequestsQueueURL) Build() (*url.URL, error) { qs.Set("branch", branchQ) } + var customerNameQ string + if o.CustomerName != nil { + customerNameQ = *o.CustomerName + } + if customerNameQ != "" { + qs.Set("customerName", customerNameQ) + } + var destinationDutyLocationQ string if o.DestinationDutyLocation != nil { destinationDutyLocationQ = *o.DestinationDutyLocation @@ -98,14 +106,6 @@ func (o *GetPaymentRequestsQueueURL) Build() (*url.URL, error) { qs.Set("emplid", emplidQ) } - var lastNameQ string - if o.LastName != nil { - lastNameQ = *o.LastName - } - if lastNameQ != "" { - qs.Set("lastName", lastNameQ) - } - var locatorQ string if o.Locator != nil { locatorQ = *o.Locator diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_parameters.go b/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_parameters.go index 20744a2c85b..81ae98c3178 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_parameters.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_parameters.go @@ -55,6 +55,10 @@ type GetServicesCounselingQueueParams struct { In: query */ CounselingOffice *string + /*filters using a prefix match on the service member's last name + In: query + */ + CustomerName *string /*filters the name of the destination duty location on the orders In: query */ @@ -67,10 +71,6 @@ type GetServicesCounselingQueueParams struct { In: query */ Emplid *string - /*filters using a prefix match on the service member's last name - In: query - */ - LastName *string /*filters to match the unique move code locator In: query */ @@ -173,6 +173,11 @@ func (o *GetServicesCounselingQueueParams) BindRequest(r *http.Request, route *m res = append(res, err) } + qCustomerName, qhkCustomerName, _ := qs.GetOK("customerName") + if err := o.bindCustomerName(qCustomerName, qhkCustomerName, route.Formats); err != nil { + res = append(res, err) + } + qDestinationDutyLocation, qhkDestinationDutyLocation, _ := qs.GetOK("destinationDutyLocation") if err := o.bindDestinationDutyLocation(qDestinationDutyLocation, qhkDestinationDutyLocation, route.Formats); err != nil { res = append(res, err) @@ -188,11 +193,6 @@ func (o *GetServicesCounselingQueueParams) BindRequest(r *http.Request, route *m res = append(res, err) } - qLastName, qhkLastName, _ := qs.GetOK("lastName") - if err := o.bindLastName(qLastName, qhkLastName, route.Formats); err != nil { - res = append(res, err) - } - qLocator, qhkLocator, _ := qs.GetOK("locator") if err := o.bindLocator(qLocator, qhkLocator, route.Formats); err != nil { res = append(res, err) @@ -382,8 +382,8 @@ func (o *GetServicesCounselingQueueParams) bindCounselingOffice(rawData []string return nil } -// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. -func (o *GetServicesCounselingQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindCustomerName binds and validates parameter CustomerName from query. +func (o *GetServicesCounselingQueueParams) bindCustomerName(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -395,13 +395,13 @@ func (o *GetServicesCounselingQueueParams) bindDestinationDutyLocation(rawData [ if raw == "" { // empty values pass all other validations return nil } - o.DestinationDutyLocation = &raw + o.CustomerName = &raw return nil } -// bindDodID binds and validates parameter DodID from query. -func (o *GetServicesCounselingQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDestinationDutyLocation binds and validates parameter DestinationDutyLocation from query. +func (o *GetServicesCounselingQueueParams) bindDestinationDutyLocation(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -413,13 +413,13 @@ func (o *GetServicesCounselingQueueParams) bindDodID(rawData []string, hasKey bo if raw == "" { // empty values pass all other validations return nil } - o.DodID = &raw + o.DestinationDutyLocation = &raw return nil } -// bindEmplid binds and validates parameter Emplid from query. -func (o *GetServicesCounselingQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindDodID binds and validates parameter DodID from query. +func (o *GetServicesCounselingQueueParams) bindDodID(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -431,13 +431,13 @@ func (o *GetServicesCounselingQueueParams) bindEmplid(rawData []string, hasKey b if raw == "" { // empty values pass all other validations return nil } - o.Emplid = &raw + o.DodID = &raw return nil } -// bindLastName binds and validates parameter LastName from query. -func (o *GetServicesCounselingQueueParams) bindLastName(rawData []string, hasKey bool, formats strfmt.Registry) error { +// bindEmplid binds and validates parameter Emplid from query. +func (o *GetServicesCounselingQueueParams) bindEmplid(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -449,7 +449,7 @@ func (o *GetServicesCounselingQueueParams) bindLastName(rawData []string, hasKey if raw == "" { // empty values pass all other validations return nil } - o.LastName = &raw + o.Emplid = &raw return nil } @@ -751,7 +751,7 @@ func (o *GetServicesCounselingQueueParams) bindSort(rawData []string, hasKey boo // validateSort carries on validations for parameter Sort func (o *GetServicesCounselingQueueParams) validateSort(formats strfmt.Registry) error { - if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"lastName", "dodID", "emplid", "branch", "locator", "status", "requestedMoveDate", "submittedAt", "originGBLOC", "originDutyLocation", "destinationDutyLocation", "ppmType", "closeoutInitiated", "closeoutLocation", "ppmStatus", "counselingOffice", "assignedTo"}, true); err != nil { + if err := validate.EnumCase("sort", "query", *o.Sort, []interface{}{"customerName", "dodID", "emplid", "branch", "locator", "status", "requestedMoveDate", "submittedAt", "originGBLOC", "originDutyLocation", "destinationDutyLocation", "ppmType", "closeoutInitiated", "closeoutLocation", "ppmStatus", "counselingOffice", "assignedTo"}, true); err != nil { return err } diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_urlbuilder.go b/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_urlbuilder.go index 5f1d7d96c2c..6e961e7143f 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_urlbuilder.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_services_counseling_queue_urlbuilder.go @@ -21,10 +21,10 @@ type GetServicesCounselingQueueURL struct { CloseoutInitiated *strfmt.DateTime CloseoutLocation *string CounselingOffice *string + CustomerName *string DestinationDutyLocation *string DodID *string Emplid *string - LastName *string Locator *string NeedsPPMCloseout *bool Order *string @@ -115,6 +115,14 @@ func (o *GetServicesCounselingQueueURL) Build() (*url.URL, error) { qs.Set("counselingOffice", counselingOfficeQ) } + var customerNameQ string + if o.CustomerName != nil { + customerNameQ = *o.CustomerName + } + if customerNameQ != "" { + qs.Set("customerName", customerNameQ) + } + var destinationDutyLocationQ string if o.DestinationDutyLocation != nil { destinationDutyLocationQ = *o.DestinationDutyLocation @@ -139,14 +147,6 @@ func (o *GetServicesCounselingQueueURL) Build() (*url.URL, error) { qs.Set("emplid", emplidQ) } - var lastNameQ string - if o.LastName != nil { - lastNameQ = *o.LastName - } - if lastNameQ != "" { - qs.Set("lastName", lastNameQ) - } - var locatorQ string if o.Locator != nil { locatorQ = *o.Locator diff --git a/pkg/handlers/ghcapi/queues.go b/pkg/handlers/ghcapi/queues.go index d7c3aeca00a..0f4b079d6be 100644 --- a/pkg/handlers/ghcapi/queues.go +++ b/pkg/handlers/ghcapi/queues.go @@ -49,7 +49,7 @@ func (h GetMovesQueueHandler) Handle(params queues.GetMovesQueueParams) middlewa Locator: params.Locator, DodID: params.DodID, Emplid: params.Emplid, - LastName: params.LastName, + CustomerName: params.CustomerName, DestinationDutyLocation: params.DestinationDutyLocation, OriginDutyLocation: params.OriginDutyLocation, AppearedInTOOAt: handlers.FmtDateTimePtrToPopPtr(params.AppearedInTooAt), @@ -238,7 +238,7 @@ func (h GetPaymentRequestsQueueHandler) Handle( Locator: params.Locator, DodID: params.DodID, Emplid: params.Emplid, - LastName: params.LastName, + CustomerName: params.CustomerName, DestinationDutyLocation: params.DestinationDutyLocation, Status: params.Status, Page: params.Page, @@ -360,7 +360,7 @@ func (h GetServicesCounselingQueueHandler) Handle( Locator: params.Locator, DodID: params.DodID, Emplid: params.Emplid, - LastName: params.LastName, + CustomerName: params.CustomerName, OriginDutyLocation: params.OriginDutyLocation, DestinationDutyLocation: params.DestinationDutyLocation, OriginGBLOC: params.OriginGBLOC, diff --git a/pkg/handlers/ghcapi/queues_test.go b/pkg/handlers/ghcapi/queues_test.go index 98d84ffafc0..aef11b33dbf 100644 --- a/pkg/handlers/ghcapi/queues_test.go +++ b/pkg/handlers/ghcapi/queues_test.go @@ -796,8 +796,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerCustomerInfoFilters() { suite.Run("returns results matching last name search term", func() { params := queues.GetMovesQueueParams{ - HTTPRequest: request, - LastName: models.StringPointer("Nan"), + HTTPRequest: request, + CustomerName: models.StringPointer("Nan"), } // Validate incoming payload: no body to validate @@ -886,7 +886,7 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerCustomerInfoFilters() { originDutyLocations = append(originDutyLocations, dutyLocation1.Name) params := queues.GetMovesQueueParams{ HTTPRequest: request, - LastName: models.StringPointer("Dar"), + CustomerName: models.StringPointer("Dar"), DodID: serviceMember1.Edipi, Locator: &move1.Locator, OriginDutyLocation: originDutyLocations, diff --git a/pkg/services/order.go b/pkg/services/order.go index a2175bc713f..1ec7eba411f 100644 --- a/pkg/services/order.go +++ b/pkg/services/order.go @@ -50,7 +50,7 @@ type ListOrderParams struct { Locator *string DodID *string Emplid *string - LastName *string + CustomerName *string DestinationDutyLocation *string OriginDutyLocation []string OriginGBLOC *string diff --git a/pkg/services/order/order_fetcher.go b/pkg/services/order/order_fetcher.go index b62d9d0c25b..88b56d0ac33 100644 --- a/pkg/services/order/order_fetcher.go +++ b/pkg/services/order/order_fetcher.go @@ -3,6 +3,7 @@ package order import ( "database/sql" "fmt" + "regexp" "strings" "time" @@ -105,7 +106,7 @@ func (f orderFetcher) ListOrders(appCtx appcontext.AppContext, officeUserID uuid locatorQuery := locatorFilter(params.Locator) dodIDQuery := dodIDFilter(params.DodID) emplidQuery := emplidFilter(params.Emplid) - lastNameQuery := lastNameFilter(params.LastName) + nameQuery := nameFilter(params.CustomerName) originDutyLocationQuery := originDutyLocationFilter(params.OriginDutyLocation) destinationDutyLocationQuery := destinationDutyLocationFilter(params.DestinationDutyLocation) moveStatusQuery := moveStatusFilter(params.Status) @@ -121,7 +122,7 @@ func (f orderFetcher) ListOrders(appCtx appcontext.AppContext, officeUserID uuid sortOrderQuery := sortOrder(params.Sort, params.Order, ppmCloseoutGblocs) counselingQuery := counselingOfficeFilter(params.CounselingOffice) // Adding to an array so we can iterate over them and apply the filters after the query structure is set below - options := [20]QueryOption{branchQuery, locatorQuery, dodIDQuery, emplidQuery, lastNameQuery, originDutyLocationQuery, destinationDutyLocationQuery, moveStatusQuery, gblocQuery, submittedAtQuery, appearedInTOOAtQuery, requestedMoveDateQuery, ppmTypeQuery, closeoutInitiatedQuery, closeoutLocationQuery, ppmStatusQuery, sortOrderQuery, SCAssignedUserQuery, TOOAssignedUserQuery, counselingQuery} + options := [20]QueryOption{branchQuery, locatorQuery, dodIDQuery, emplidQuery, nameQuery, originDutyLocationQuery, destinationDutyLocationQuery, moveStatusQuery, gblocQuery, submittedAtQuery, appearedInTOOAtQuery, requestedMoveDateQuery, ppmTypeQuery, closeoutInitiatedQuery, closeoutLocationQuery, ppmStatusQuery, sortOrderQuery, SCAssignedUserQuery, TOOAssignedUserQuery, counselingQuery} var query *pop.Query if ppmCloseoutGblocs { @@ -512,12 +513,18 @@ func branchFilter(branch *string, needsCounseling bool, ppmCloseoutGblocs bool) } } -func lastNameFilter(lastName *string) QueryOption { +func nameFilter(name *string) QueryOption { return func(query *pop.Query) { - if lastName != nil { - nameSearch := fmt.Sprintf("%s%%", *lastName) - query.Where("service_members.last_name ILIKE ?", nameSearch) + if name == nil { + return } + + // Remove "," that user may enter between names (displayed on frontend column) + nameQueryParam := *name + removeCharsRegex := regexp.MustCompile("[,]+") + nameQueryParam = removeCharsRegex.ReplaceAllString(nameQueryParam, "") + nameQueryParam = fmt.Sprintf("%%%s%%", nameQueryParam) + query.Where("(service_members.last_name || ' ' || service_members.first_name) ILIKE ?", nameQueryParam) } } @@ -717,7 +724,7 @@ func gblocFilterForPPMCloseoutForNavyMarineAndCG(gbloc *string) QueryOption { func sortOrder(sort *string, order *string, ppmCloseoutGblocs bool) QueryOption { parameters := map[string]string{ - "lastName": "service_members.last_name", + "customerName": "(service_members.last_name || ' ' || service_members.first_name)", "dodID": "service_members.edipi", "emplid": "service_members.emplid", "branch": "service_members.affiliation", @@ -746,7 +753,7 @@ func sortOrder(sort *string, order *string, ppmCloseoutGblocs bool) QueryOption return } if sortTerm, ok := parameters[*sort]; ok { - if *sort == "lastName" { + if *sort == "customerName" { query.Order(fmt.Sprintf("service_members.last_name %s, service_members.first_name %s", *order, *order)) } else if *sort == "assignedTo" { query.Order(fmt.Sprintf("assigned_user.last_name %s, assigned_user.first_name %s", *order, *order)) diff --git a/pkg/services/order/order_fetcher_test.go b/pkg/services/order/order_fetcher_test.go index 392dff868fc..7c6762a162a 100644 --- a/pkg/services/order/order_fetcher_test.go +++ b/pkg/services/order/order_fetcher_test.go @@ -1275,7 +1275,7 @@ func (suite *OrderServiceSuite) TestListOrdersWithSortOrder() { }, }, }, nil) - params := services.ListOrderParams{Sort: models.StringPointer("lastName"), Order: models.StringPointer("asc")} + params := services.ListOrderParams{Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) suite.NoError(err) @@ -1284,7 +1284,7 @@ func (suite *OrderServiceSuite) TestListOrdersWithSortOrder() { suite.Equal("Spacemen, Leo", *moves[1].Orders.ServiceMember.LastName+", "+*moves[1].Orders.ServiceMember.FirstName) suite.Equal("Zephyer, Leo", *moves[2].Orders.ServiceMember.LastName+", "+*moves[2].Orders.ServiceMember.FirstName) - params = services.ListOrderParams{Sort: models.StringPointer("lastName"), Order: models.StringPointer("desc")} + params = services.ListOrderParams{Sort: models.StringPointer("customerName"), Order: models.StringPointer("desc")} moves, _, err = orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) suite.NoError(err) @@ -2021,6 +2021,114 @@ func (suite *OrderServiceSuite) TestListAllOrderLocations() { }) } +func (suite *OrderServiceSuite) TestListOrdersFilteredByCustomerName() { + serviceMemberFirstName := "Hanna" + serviceMemberLastName := "Starlight" + edipi := "9999999998" + var officeUser models.OfficeUser + var session auth.Session + + requestedMoveDate1 := time.Date(testdatagen.GHCTestYear, 05, 20, 0, 0, 0, 0, time.UTC) + requestedMoveDate2 := time.Date(testdatagen.GHCTestYear, 07, 03, 0, 0, 0, 0, time.UTC) + + suite.PreloadData(func() { + factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ + { + Model: models.Move{ + Status: models.MoveStatusAPPROVED, + Locator: "AA1235", + }, + }, + { + Model: models.MTOShipment{ + RequestedPickupDate: &requestedMoveDate1, + }, + }, + }, nil) + factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ + { + Model: models.Move{ + Locator: "TTZ125", + }, + }, + { + Model: models.ServiceMember{ + FirstName: &serviceMemberFirstName, + Edipi: &edipi, + }, + }, + { + Model: models.MTOShipment{ + RequestedPickupDate: &requestedMoveDate2, + }, + }, + }, nil) + factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ + { + Model: models.ServiceMember{ // Leo Zephyer + LastName: &serviceMemberLastName, + }, + }, + }, nil) + officeUser = factory.BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeTOO}) + session = auth.Session{ + ApplicationName: auth.OfficeApp, + Roles: officeUser.User.Roles, + OfficeUserID: officeUser.ID, + IDToken: "fake_token", + AccessToken: "fakeAccessToken", + } + }) + + orderFetcher := NewOrderFetcher() + + suite.Run("list moves by customer name - full name", func() { + // Search "Spacemen, Hanna" + params := services.ListOrderParams{CustomerName: models.StringPointer("Spacemen, Hanna"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) + suite.NoError(err) + suite.Equal(1, len(moves)) + suite.Equal("Spacemen, Hanna", *moves[0].Orders.ServiceMember.LastName+", "+*moves[0].Orders.ServiceMember.FirstName) + }) + + suite.Run("list moves by customer name - partial last (multiple)", func() { + // Search "space" + params := services.ListOrderParams{CustomerName: models.StringPointer("space"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) + suite.NoError(err) + suite.Equal(2, len(moves)) + suite.Equal("Spacemen, Hanna", *moves[0].Orders.ServiceMember.LastName+", "+*moves[0].Orders.ServiceMember.FirstName) + suite.Equal("Spacemen, Leo", *moves[1].Orders.ServiceMember.LastName+", "+*moves[1].Orders.ServiceMember.FirstName) + }) + + suite.Run("list moves by customer name - partial last (single)", func() { + // Search "Light" + params := services.ListOrderParams{CustomerName: models.StringPointer("Light"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) + suite.NoError(err) + suite.Equal(1, len(moves)) + suite.Equal("Starlight, Leo", *moves[0].Orders.ServiceMember.LastName+", "+*moves[0].Orders.ServiceMember.FirstName) + }) + + suite.Run("list moves by customer name - partial first", func() { + // Search "leo" + params := services.ListOrderParams{CustomerName: models.StringPointer("leo"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) + suite.NoError(err) + suite.Equal(2, len(moves)) + suite.Equal("Spacemen, Leo", *moves[0].Orders.ServiceMember.LastName+", "+*moves[0].Orders.ServiceMember.FirstName) + suite.Equal("Starlight, Leo", *moves[1].Orders.ServiceMember.LastName+", "+*moves[1].Orders.ServiceMember.FirstName) + }) + + suite.Run("list moves by customer name - empty", func() { + // Search "johnny" + params := services.ListOrderParams{CustomerName: models.StringPointer("johnny"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + moves, _, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), officeUser.ID, roles.RoleTypeTOO, ¶ms) + suite.NoError(err) + suite.Equal(0, len(moves)) + + }) +} func (suite *OrderServiceSuite) TestOriginDutyLocationFilter() { var session auth.Session var expectedMove models.Move diff --git a/pkg/services/payment_request.go b/pkg/services/payment_request.go index 25f62be43a4..836fc9f4fd4 100644 --- a/pkg/services/payment_request.go +++ b/pkg/services/payment_request.go @@ -82,7 +82,7 @@ type FetchPaymentRequestListParams struct { Locator *string DodID *string Emplid *string - LastName *string + CustomerName *string DestinationDutyLocation *string Status []string Page *int64 diff --git a/pkg/services/payment_request/payment_request_list_fetcher.go b/pkg/services/payment_request/payment_request_list_fetcher.go index 689337076f8..7b0dc33b6be 100644 --- a/pkg/services/payment_request/payment_request_list_fetcher.go +++ b/pkg/services/payment_request/payment_request_list_fetcher.go @@ -2,6 +2,7 @@ package paymentrequest import ( "fmt" + "regexp" "strings" "time" @@ -19,7 +20,7 @@ type paymentRequestListFetcher struct { } var parameters = map[string]string{ - "lastName": "service_members.last_name", + "customerName": "(service_members.last_name || ' ' || service_members.first_name)", "dodID": "service_members.edipi", "emplid": "service_members.emplid", "submittedAt": "payment_requests.created_at", @@ -92,14 +93,14 @@ func (f *paymentRequestListFetcher) FetchPaymentRequestList(appCtx appcontext.Ap locatorQuery := locatorFilter(params.Locator) dodIDQuery := dodIDFilter(params.DodID) emplidQuery := emplidFilter(params.Emplid) - lastNameQuery := lastNameFilter(params.LastName) + nameQuery := nameFilter(params.CustomerName) dutyLocationQuery := destinationDutyLocationFilter(params.DestinationDutyLocation) statusQuery := paymentRequestsStatusFilter(params.Status) submittedAtQuery := submittedAtFilter(params.SubmittedAt) originDutyLocationQuery := dutyLocationFilter(params.OriginDutyLocation) orderQuery := sortOrder(params.Sort, params.Order) - options := [11]QueryOption{branchQuery, locatorQuery, dodIDQuery, lastNameQuery, dutyLocationQuery, statusQuery, originDutyLocationQuery, submittedAtQuery, gblocQuery, orderQuery, emplidQuery} + options := [11]QueryOption{branchQuery, locatorQuery, dodIDQuery, nameQuery, dutyLocationQuery, statusQuery, originDutyLocationQuery, submittedAtQuery, gblocQuery, orderQuery, emplidQuery} for _, option := range options { if option != nil { @@ -304,12 +305,17 @@ func branchFilter(branch *string) QueryOption { } } -func lastNameFilter(lastName *string) QueryOption { +func nameFilter(name *string) QueryOption { return func(query *pop.Query) { - if lastName != nil { - nameSearch := fmt.Sprintf("%s%%", *lastName) - query.Where("service_members.last_name ILIKE ?", nameSearch) + if name == nil { + return } + // Remove "," that user may enter between names (displayed on frontend column) + nameQueryParam := *name + removeCharsRegex := regexp.MustCompile("[,]+") + nameQueryParam = removeCharsRegex.ReplaceAllString(nameQueryParam, "") + nameQueryParam = fmt.Sprintf("%%%s%%", nameQueryParam) + query.Where("(service_members.last_name || ' ' || service_members.first_name) ILIKE ?", nameQueryParam) } } diff --git a/pkg/services/payment_request/payment_request_list_fetcher_test.go b/pkg/services/payment_request/payment_request_list_fetcher_test.go index ef0db99e2d5..f28c14c5533 100644 --- a/pkg/services/payment_request/payment_request_list_fetcher_test.go +++ b/pkg/services/payment_request/payment_request_list_fetcher_test.go @@ -962,3 +962,161 @@ func (suite *PaymentRequestServiceSuite) TestListPaymentRequestWithSortOrder() { suite.Equal(expectedOriginDutyLocation[1], string(paymentRequests[0].MoveTaskOrder.Orders.OriginDutyLocation.Name)) }) } + +func (suite *PaymentRequestServiceSuite) TestListPaymentRequestNameFilter() { + var officeUser models.OfficeUser + var session auth.Session + + paymentRequestListFetcher := NewPaymentRequestListFetcher() + + suite.PreloadData(func() { + officeUser = factory.BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeTIO}) + session = auth.Session{ + ApplicationName: auth.OfficeApp, + Roles: officeUser.User.Roles, + OfficeUserID: officeUser.ID, + IDToken: "fake_token", + AccessToken: "fakeAccessToken", + } + + originDutyLocation1 := factory.BuildDutyLocation(suite.DB(), []factory.Customization{ + { + Model: models.DutyLocation{ + Name: "Applewood, CA 99999", + }, + }, + }, nil) + + originDutyLocation2 := factory.BuildDutyLocation(suite.DB(), []factory.Customization{ + { + Model: models.DutyLocation{ + Name: "Scott AFB", + }, + }, + }, nil) + + expectedMove1 := factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ + { + Model: models.ServiceMember{ + Edipi: models.StringPointer("1234512345"), + LastName: models.StringPointer("Spacemen"), + FirstName: models.StringPointer("Lena"), + Emplid: models.StringPointer(""), + }, + }, + { + Model: models.Move{ + Locator: "AAAA", + }, + }, + { + Model: originDutyLocation1, + LinkOnly: true, + Type: &factory.DutyLocations.OriginDutyLocation, + }, + }, nil) + + expectedMove2 := factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ + { + Model: models.ServiceMember{ + FirstName: models.StringPointer("Leo"), + LastName: models.StringPointer("Spacemen"), + Edipi: models.StringPointer("1234567899"), + Emplid: models.StringPointer("1111111"), + }, + }, + { + Model: models.Move{ + Locator: "ZZZZ", + }, + }, + { + Model: originDutyLocation2, + LinkOnly: true, + Type: &factory.DutyLocations.OriginDutyLocation, + }, + }, nil) + + // Fake this as a day and a half in the past so floating point age values can be tested + prevCreatedAt := time.Now().Add(time.Duration(time.Hour * -36)) + factory.BuildPaymentRequest(suite.DB(), []factory.Customization{ + { + Model: models.PaymentRequest{ + Status: models.PaymentRequestStatusPending, + CreatedAt: prevCreatedAt, + }, + }, + { + Model: expectedMove1, + LinkOnly: true, + }, + }, nil) + paymentRequest2 := factory.BuildPaymentRequest(suite.DB(), []factory.Customization{ + { + Model: models.PaymentRequest{ + Status: models.PaymentRequestStatusReviewed, + }, + }, + { + Model: expectedMove2, + LinkOnly: true, + }, + }, nil) + + factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: paymentRequest2.MoveTaskOrder, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + Status: models.MTOShipmentStatusSubmitted, + }, + }, + }, nil) + }) + + suite.Run("filter payment requests by customer name - full name", func() { + // Search "Spacemen, Lena" + params := services.FetchPaymentRequestListParams{CustomerName: models.StringPointer("Spacemen, Lena"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + expectedPaymentRequests, _, err := paymentRequestListFetcher.FetchPaymentRequestList(suite.AppContextWithSessionForTest(&session), officeUser.ID, ¶ms) + paymentRequests := *expectedPaymentRequests + + suite.NoError(err) + suite.Equal(1, len(paymentRequests)) + suite.Equal("Spacemen, Lena", *paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.LastName+", "+*paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.FirstName) + }) + + suite.Run("filter payment requests by customer name - last", func() { + // Search "Spacemen " + params := services.FetchPaymentRequestListParams{CustomerName: models.StringPointer("Spacemen "), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + expectedPaymentRequests, _, err := paymentRequestListFetcher.FetchPaymentRequestList(suite.AppContextWithSessionForTest(&session), officeUser.ID, ¶ms) + paymentRequests := *expectedPaymentRequests + + suite.NoError(err) + suite.Equal(2, len(paymentRequests)) + suite.Equal("Spacemen, Lena", *paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.LastName+", "+*paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.FirstName) + suite.Equal("Spacemen, Leo", *paymentRequests[1].MoveTaskOrder.Orders.ServiceMember.LastName+", "+*paymentRequests[1].MoveTaskOrder.Orders.ServiceMember.FirstName) + }) + + suite.Run("filter payment requests by customer name - first", func() { + // Search "lena" + params := services.FetchPaymentRequestListParams{CustomerName: models.StringPointer("lena"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + expectedPaymentRequests, _, err := paymentRequestListFetcher.FetchPaymentRequestList(suite.AppContextWithSessionForTest(&session), officeUser.ID, ¶ms) + paymentRequests := *expectedPaymentRequests + + suite.NoError(err) + suite.Equal(1, len(paymentRequests)) + suite.Equal("Spacemen, Lena", *paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.LastName+", "+*paymentRequests[0].MoveTaskOrder.Orders.ServiceMember.FirstName) + }) + + suite.Run("filter payment requests by customer name - empty", func() { + // Search "johnny" + params := services.FetchPaymentRequestListParams{CustomerName: models.StringPointer("johnny"), Sort: models.StringPointer("customerName"), Order: models.StringPointer("asc")} + expectedPaymentRequests, _, err := paymentRequestListFetcher.FetchPaymentRequestList(suite.AppContextWithSessionForTest(&session), officeUser.ID, ¶ms) + paymentRequests := *expectedPaymentRequests + + suite.NoError(err) + suite.Equal(0, len(paymentRequests)) + }) +} diff --git a/src/pages/Office/HeadquartersQueues/HeadquartersQueues.test.jsx b/src/pages/Office/HeadquartersQueues/HeadquartersQueues.test.jsx index 76f4e8ae93d..30b328ebe3f 100644 --- a/src/pages/Office/HeadquartersQueues/HeadquartersQueues.test.jsx +++ b/src/pages/Office/HeadquartersQueues/HeadquartersQueues.test.jsx @@ -198,7 +198,7 @@ describe('HeadquartersQueue', () => { const moves = GetMountedComponent(hqRoutes.MOVE_QUEUE).find('tbody tr'); const firstMove = moves.at(0); - expect(firstMove.find({ 'data-testid': 'lastName-0' }).text()).toBe('test last, test first'); + expect(firstMove.find({ 'data-testid': 'customerName-0' }).text()).toBe('test last, test first'); expect(firstMove.find({ 'data-testid': 'dodID-0' }).text()).toBe('555555555'); expect(firstMove.find({ 'data-testid': 'status-0' }).text()).toBe('New move'); expect(firstMove.find({ 'data-testid': 'locator-0' }).text()).toBe('AB5P'); @@ -210,7 +210,7 @@ describe('HeadquartersQueue', () => { expect(firstMove.find({ 'data-testid': 'appearedInTooAt-0' }).text()).toBe('10 Feb 2023'); const secondMove = moves.at(1); - expect(secondMove.find({ 'data-testid': 'lastName-1' }).text()).toBe('test another last, test another first'); + expect(secondMove.find({ 'data-testid': 'customerName-1' }).text()).toBe('test another last, test another first'); expect(secondMove.find({ 'data-testid': 'dodID-1' }).text()).toBe('4444444444'); expect(secondMove.find({ 'data-testid': 'status-1' }).text()).toBe('Move approved'); expect(secondMove.find({ 'data-testid': 'locator-1' }).text()).toBe('T12A'); @@ -247,11 +247,11 @@ describe('HeadquartersQueue', () => { expect(wrapper.find({ 'data-testid': 'status' }).at(0).hasClass('sortAscending')).toBe(false); expect(wrapper.find({ 'data-testid': 'status' }).at(0).hasClass('sortDescending')).toBe(false); - const nameHeading = wrapper.find({ 'data-testid': 'lastName' }).at(0); + const nameHeading = wrapper.find({ 'data-testid': 'customerName' }).at(0); nameHeading.simulate('click'); wrapper.update(); - expect(wrapper.find({ 'data-testid': 'lastName' }).at(0).hasClass('sortAscending')).toBe(true); + expect(wrapper.find({ 'data-testid': 'customerName' }).at(0).hasClass('sortAscending')).toBe(true); }); it('filters the queue', () => { diff --git a/src/pages/Office/MoveQueue/MoveQueue.jsx b/src/pages/Office/MoveQueue/MoveQueue.jsx index 17d0197345c..9574c7203b4 100644 --- a/src/pages/Office/MoveQueue/MoveQueue.jsx +++ b/src/pages/Office/MoveQueue/MoveQueue.jsx @@ -62,7 +62,7 @@ export const columns = (moveLockFlag, isQueueManagementEnabled, showBranchFilter ); }, { - id: 'lastName', + id: 'customerName', isFilterable: true, exportValue: (row) => { return `${row.customer.last_name}, ${row.customer.first_name}`; diff --git a/src/pages/Office/MoveQueue/MoveQueue.test.jsx b/src/pages/Office/MoveQueue/MoveQueue.test.jsx index d235c09cc4e..8cce5ad31d9 100644 --- a/src/pages/Office/MoveQueue/MoveQueue.test.jsx +++ b/src/pages/Office/MoveQueue/MoveQueue.test.jsx @@ -190,7 +190,7 @@ describe('MoveQueue', () => { const moves = GetMountedComponent(tooRoutes.MOVE_QUEUE).find('tbody tr'); currentMove = moves.at(currentIndex); - expect(currentMove.find({ 'data-testid': `lastName-${currentIndex}` }).text()).toBe( + expect(currentMove.find({ 'data-testid': `customerName-${currentIndex}` }).text()).toBe( `${moveData[currentIndex].customer.last_name}, ${moveData[currentIndex].customer.first_name}`, ); expect(currentMove.find({ 'data-testid': `dodID-${currentIndex}` }).text()).toBe( @@ -215,10 +215,10 @@ describe('MoveQueue', () => { currentIndex += 1; currentMove = moves.at(currentIndex); - expect(currentMove.find({ 'data-testid': `lastName-${currentIndex}` }).text()).toBe( + expect(currentMove.find({ 'data-testid': `customerName-${currentIndex}` }).text()).toBe( 'test another last, test another first', ); - expect(currentMove.find({ 'data-testid': `lastName-${currentIndex}` }).text()).toBe( + expect(currentMove.find({ 'data-testid': `customerName-${currentIndex}` }).text()).toBe( `${moveData[currentIndex].customer.last_name}, ${moveData[currentIndex].customer.first_name}`, ); expect(currentMove.find({ 'data-testid': `dodID-${currentIndex}` }).text()).toBe( @@ -246,7 +246,7 @@ describe('MoveQueue', () => { currentIndex += 1; currentMove = moves.at(currentIndex); - expect(currentMove.find({ 'data-testid': `lastName-${currentIndex}` }).text()).toBe( + expect(currentMove.find({ 'data-testid': `customerName-${currentIndex}` }).text()).toBe( `${moveData[currentIndex].customer.last_name}, ${moveData[currentIndex].customer.first_name}`, ); expect(currentMove.find({ 'data-testid': `dodID-${currentIndex}` }).text()).toBe( @@ -296,11 +296,11 @@ describe('MoveQueue', () => { expect(wrapper.find({ 'data-testid': 'status' }).at(0).hasClass('sortAscending')).toBe(false); expect(wrapper.find({ 'data-testid': 'status' }).at(0).hasClass('sortDescending')).toBe(false); - const nameHeading = wrapper.find({ 'data-testid': 'lastName' }).at(0); + const nameHeading = wrapper.find({ 'data-testid': 'customerName' }).at(0); nameHeading.simulate('click'); wrapper.update(); - expect(wrapper.find({ 'data-testid': 'lastName' }).at(0).hasClass('sortAscending')).toBe(true); + expect(wrapper.find({ 'data-testid': 'customerName' }).at(0).hasClass('sortAscending')).toBe(true); }); it('filters the queue', () => { diff --git a/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.jsx b/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.jsx index 6179ed0a0f1..03b569f1b55 100644 --- a/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.jsx +++ b/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.jsx @@ -63,7 +63,7 @@ export const columns = (moveLockFlag, showBranchFilter = true) => [ ); }, { - id: 'lastName', + id: 'customerName', isFilterable: true, exportValue: (row) => { return `${row.customer.last_name}, ${row.customer.first_name}`; diff --git a/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.test.jsx b/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.test.jsx index f86a76369ee..16191b86279 100644 --- a/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.test.jsx +++ b/src/pages/Office/PaymentRequestQueue/PaymentRequestQueue.test.jsx @@ -174,11 +174,11 @@ describe('PaymentRequestQueue', () => { expect(wrapper.find({ 'data-testid': 'age' }).at(0).hasClass('sortAscending')).toBe(true); - const nameHeading = wrapper.find({ 'data-testid': 'lastName' }).at(0); + const nameHeading = wrapper.find({ 'data-testid': 'customerName' }).at(0); nameHeading.simulate('click'); wrapper.update(); - expect(wrapper.find({ 'data-testid': 'lastName' }).at(0).hasClass('sortAscending')).toBe(true); + expect(wrapper.find({ 'data-testid': 'customerName' }).at(0).hasClass('sortAscending')).toBe(true); }); it('displays the payment request ', async () => { diff --git a/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.jsx b/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.jsx index 2ec0fb7a77c..0b961e2e3c6 100644 --- a/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.jsx +++ b/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.jsx @@ -82,7 +82,7 @@ export const counselingColumns = (moveLockFlag, originLocationList, supervisor, ); }, { - id: 'lastName', + id: 'customerName', isFilterable: true, exportValue: (row) => { return `${row.customer.last_name}, ${row.customer.first_name}`; diff --git a/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.test.jsx b/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.test.jsx index 002e4fe78db..208725bc202 100644 --- a/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.test.jsx +++ b/src/pages/Office/ServicesCounselingQueue/ServicesCounselingQueue.test.jsx @@ -308,7 +308,7 @@ describe('ServicesCounselingQueue', () => { it('formats the move data in rows', () => { const moves = wrapper.find('tbody tr'); const firstMove = moves.at(0); - expect(firstMove.find('td.lastName').text()).toBe('test last, test first'); + expect(firstMove.find('td.customerName').text()).toBe('test last, test first'); expect(firstMove.find('td.dodID').text()).toBe('555555555'); expect(firstMove.find('td.locator').text()).toBe('AB5PC'); expect(firstMove.find('td.status').text()).toBe('Needs counseling'); @@ -320,7 +320,7 @@ describe('ServicesCounselingQueue', () => { expect(firstMove.find('td.assignedTo').text()).toBe('John, Jimmy'); const secondMove = moves.at(1); - expect(secondMove.find('td.lastName').text()).toBe('test another last, test another first'); + expect(secondMove.find('td.customerName').text()).toBe('test another last, test another first'); expect(secondMove.find('td.dodID').text()).toBe('4444444444'); expect(secondMove.find('td.emplid').text()).toBe('4521567'); expect(secondMove.find('td.locator').text()).toBe('T12AR'); @@ -333,7 +333,7 @@ describe('ServicesCounselingQueue', () => { expect(secondMove.find('td.assignedTo').text()).toBe('Denver, John'); const thirdMove = moves.at(2); - expect(thirdMove.find('td.lastName').text()).toBe('test third last, test third first'); + expect(thirdMove.find('td.customerName').text()).toBe('test third last, test third first'); expect(thirdMove.find('td.dodID').text()).toBe('4444444444'); expect(thirdMove.find('td.locator').text()).toBe('T12MP'); expect(thirdMove.find('td.status').text()).toBe('Needs counseling'); @@ -350,7 +350,7 @@ describe('ServicesCounselingQueue', () => { }); it('allows sorting on certain columns', () => { - expect(wrapper.find('th[data-testid="lastName"][role="columnheader"]').prop('onClick')).not.toBe(undefined); + expect(wrapper.find('th[data-testid="customerName"][role="columnheader"]').prop('onClick')).not.toBe(undefined); expect(wrapper.find('th[data-testid="dodID"][role="columnheader"]').prop('onClick')).not.toBe(undefined); expect(wrapper.find('th[data-testid="emplid"][role="columnheader"]').prop('onClick')).not.toBe(undefined); expect(wrapper.find('th[data-testid="locator"][role="columnheader"]').prop('onClick')).not.toBe(undefined); @@ -378,7 +378,7 @@ describe('ServicesCounselingQueue', () => { describe('verify cached filters are displayed in respective filter column header on page reload - Service Counselor', () => { window.sessionStorage.setItem( OFFICE_TABLE_QUEUE_SESSION_STORAGE_ID, - '{"counseling":{"filters":[{"id":"lastName","value":"Spacemen"},{"id":"dodID","value":"7232607949"},{"id":"locator","value":"PPMADD"},{"id":"requestedMoveDate","value":"2024-06-21"},{"id":"submittedAt","value":"2024-06-20T04:00:00+00:00"},{"id":"branch","value":"ARMY"},{"id":"originDutyLocation","value":"12345"}], "sortParam":[{"id":"lastName","desc":false}], "page":3,"pageSize":10}}', + '{"counseling":{"filters":[{"id":"customerName","value":"Spacemen"},{"id":"dodID","value":"7232607949"},{"id":"locator","value":"PPMADD"},{"id":"requestedMoveDate","value":"2024-06-21"},{"id":"submittedAt","value":"2024-06-20T04:00:00+00:00"},{"id":"branch","value":"ARMY"},{"id":"originDutyLocation","value":"12345"}], "sortParam":[{"id":"customerName","desc":false}], "page":3,"pageSize":10}}', ); useUserQueries.mockReturnValue(serviceCounselorUser); @@ -414,7 +414,7 @@ describe('ServicesCounselingQueue', () => { // Verify controls are using cached data on load. // If any of these fail check setup data window.sessionStorage.setItem() - expect(wrapper.find('th[data-testid="lastName"] input').instance().value).toBe('Spacemen'); + expect(wrapper.find('th[data-testid="customerName"] input').instance().value).toBe('Spacemen'); expect(wrapper.find('th[data-testid="dodID"] input').instance().value).toBe('7232607949'); expect(wrapper.find('th[data-testid="locator"] input').instance().value).toBe('PPMADD'); expect(wrapper.find('th[data-testid="requestedMoveDate"] input').instance().value).toBe('21 Jun 2024'); @@ -423,7 +423,9 @@ describe('ServicesCounselingQueue', () => { expect(wrapper.find('th[data-testid="branch"] select').instance().value).toBe('ARMY'); expect(wrapper.find('[data-testid="pagination"] select[id="table-rows-per-page"]').instance().value).toBe('10'); expect(wrapper.find('[data-testid="pagination"] select[id="table-pagination"]').instance().value).toBe('2'); - expect(wrapper.find('th[data-testid="lastName"][role="columnheader"]').instance().className).toBe('sortAscending'); + expect(wrapper.find('th[data-testid="customerName"][role="columnheader"]').instance().className).toBe( + 'sortAscending', + ); }); describe('filter sessionStorage filters - no cache- Service Counselor', () => { @@ -435,7 +437,7 @@ describe('ServicesCounselingQueue', () => { , ); - expect(wrapper.find('th[data-testid="lastName"] input').instance().value).toBe(''); + expect(wrapper.find('th[data-testid="customerName"] input').instance().value).toBe(''); expect(wrapper.find('th[data-testid="dodID"] input').instance().value).toBe(''); expect(wrapper.find('th[data-testid="locator"] input').instance().value).toBe(''); expect(wrapper.find('th[data-testid="requestedMoveDate"] input').instance().value).toBe(''); diff --git a/swagger-def/ghc.yaml b/swagger-def/ghc.yaml index ddc6d3dc44c..50aedcb88e2 100644 --- a/swagger-def/ghc.yaml +++ b/swagger-def/ghc.yaml @@ -3252,7 +3252,7 @@ paths: type: string enum: [ - lastName, + customerName, dodID, emplid, branch, @@ -3285,7 +3285,7 @@ paths: type: string description: filters to match the unique move code locator - in: query - name: lastName + name: customerName type: string description: filters using a prefix match on the service member's last name - in: query @@ -3482,7 +3482,7 @@ paths: type: string enum: [ - lastName, + customerName, dodID, emplid, branch, @@ -3507,7 +3507,7 @@ paths: name: locator type: string - in: query - name: lastName + name: customerName type: string - in: query name: dodID @@ -3581,7 +3581,7 @@ paths: - in: query name: sort type: string - enum: [lastName, locator, submittedAt, branch, status, dodID, emplid, age, originDutyLocation] + enum: [customerName, locator, submittedAt, branch, status, dodID, emplid, age, originDutyLocation] description: field that results should be sorted by - in: query name: order @@ -3608,7 +3608,7 @@ paths: name: locator type: string - in: query - name: lastName + name: customerName type: string - in: query name: dodID diff --git a/swagger/ghc.yaml b/swagger/ghc.yaml index 71722d9cd7b..c503b522575 100644 --- a/swagger/ghc.yaml +++ b/swagger/ghc.yaml @@ -3373,7 +3373,7 @@ paths: name: sort type: string enum: - - lastName + - customerName - dodID - emplid - branch @@ -3407,7 +3407,7 @@ paths: type: string description: filters to match the unique move code locator - in: query - name: lastName + name: customerName type: string description: filters using a prefix match on the service member's last name - in: query @@ -3632,7 +3632,7 @@ paths: name: sort type: string enum: - - lastName + - customerName - dodID - emplid - branch @@ -3658,7 +3658,7 @@ paths: name: locator type: string - in: query - name: lastName + name: customerName type: string - in: query name: dodID @@ -3737,7 +3737,7 @@ paths: name: sort type: string enum: - - lastName + - customerName - locator - submittedAt - branch @@ -3776,7 +3776,7 @@ paths: name: locator type: string - in: query - name: lastName + name: customerName type: string - in: query name: dodID