From fd03584b70d50fd5ff5300e60a9cfc81c5f268dc Mon Sep 17 00:00:00 2001 From: pambecker <150711493+pambecker@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:24:55 -0500 Subject: [PATCH] Revert "B-20001" --- cmd/pptas-api-client/main.go | 8 +- .../pptas/{pptas_reports.go => list_moves.go} | 18 +- pkg/gen/pptasapi/configure_mymove.go | 6 +- pkg/gen/pptasapi/embedded_spec.go | 1560 +---------------- .../pptasoperations/moves/list_moves.go | 64 + ...parameters.go => list_moves_parameters.go} | 20 +- .../moves/list_moves_responses.go | 197 +++ ...urlbuilder.go => list_moves_urlbuilder.go} | 22 +- .../pptasoperations/moves/pptas_reports.go | 58 - .../moves/pptas_reports_responses.go | 197 --- .../pptasapi/pptasoperations/mymove_api.go | 14 +- .../moves/list_moves_parameters.go | 165 ++ .../pptasclient/moves/list_moves_responses.go | 323 ++++ pkg/gen/pptasclient/moves/moves_client.go | 25 +- .../moves/pptas_reports_parameters.go | 165 -- .../moves/pptas_reports_responses.go | 323 ---- pkg/gen/pptasmessages/address.go | 372 ---- pkg/gen/pptasmessages/affiliation.go | 101 -- pkg/gen/pptasmessages/crate.go | 163 -- pkg/gen/pptasmessages/dimension_type.go | 78 - pkg/gen/pptasmessages/list_move.go | 293 ++++ .../{p_p_t_a_s_reports.go => list_moves.go} | 14 +- .../m_t_o_service_item_dimension.go | 138 -- pkg/gen/pptasmessages/p_p_t_a_s_report.go | 510 ------ pkg/gen/pptasmessages/p_p_t_a_s_shipment.go | 532 ------ pkg/handlers/pptasapi/api.go | 18 +- .../internal/payloads/model_to_payload.go | 126 +- .../payloads/model_to_payload_test.go | 72 - .../internal/payloads/payloads_test.go | 27 - pkg/handlers/pptasapi/moves.go | 42 + pkg/handlers/pptasapi/pptas_report.go | 46 - pkg/models/move.go | 12 - pkg/models/pptas_report.go | 109 -- pkg/services/line_of_accounting.go | 1 - .../line_of_accounting_fetcher.go | 131 -- pkg/services/mocks/LineOfAccountingFetcher.go | 14 - pkg/services/mocks/MoveFetcher.go | 26 - pkg/services/mocks/PPMEstimator.go | 66 - pkg/services/mocks/PPTASReportListFetcher.go | 83 - pkg/services/mocks/ReportListFetcher.go | 57 - pkg/services/move.go | 1 - pkg/services/move/move_fetcher.go | 49 - pkg/services/ppmshipment.go | 1 - pkg/services/ppmshipment/ppm_estimator.go | 170 -- .../ppmshipment/ppm_estimator_test.go | 33 - pkg/services/pptas_report.go | 14 - .../pptas_report/pptas_report_list_fetcher.go | 554 ------ .../pptas_report_list_fetcher_test.go | 128 -- .../pptas_report/pptas_report_service_test.go | 22 - swagger-def/definitions/Crate.yaml | 10 - swagger-def/definitions/ListMove.yaml | 41 + swagger-def/definitions/ListMoves.yaml | 3 + swagger-def/definitions/PPTASReport.yaml | 162 -- swagger-def/definitions/PPTASReports.yaml | 3 - swagger-def/definitions/PPTASShipment.yaml | 246 --- swagger-def/pptas.yaml | 16 +- swagger/pptas.yaml | 675 +------ 57 files changed, 1351 insertions(+), 6973 deletions(-) rename cmd/pptas-api-client/pptas/{pptas_reports.go => list_moves.go} (82%) create mode 100644 pkg/gen/pptasapi/pptasoperations/moves/list_moves.go rename pkg/gen/pptasapi/pptasoperations/moves/{pptas_reports_parameters.go => list_moves_parameters.go} (76%) create mode 100644 pkg/gen/pptasapi/pptasoperations/moves/list_moves_responses.go rename pkg/gen/pptasapi/pptasoperations/moves/{pptas_reports_urlbuilder.go => list_moves_urlbuilder.go} (73%) delete mode 100644 pkg/gen/pptasapi/pptasoperations/moves/pptas_reports.go delete mode 100644 pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_responses.go create mode 100644 pkg/gen/pptasclient/moves/list_moves_parameters.go create mode 100644 pkg/gen/pptasclient/moves/list_moves_responses.go delete mode 100644 pkg/gen/pptasclient/moves/pptas_reports_parameters.go delete mode 100644 pkg/gen/pptasclient/moves/pptas_reports_responses.go delete mode 100644 pkg/gen/pptasmessages/address.go delete mode 100644 pkg/gen/pptasmessages/affiliation.go delete mode 100644 pkg/gen/pptasmessages/crate.go delete mode 100644 pkg/gen/pptasmessages/dimension_type.go create mode 100644 pkg/gen/pptasmessages/list_move.go rename pkg/gen/pptasmessages/{p_p_t_a_s_reports.go => list_moves.go} (77%) delete mode 100644 pkg/gen/pptasmessages/m_t_o_service_item_dimension.go delete mode 100644 pkg/gen/pptasmessages/p_p_t_a_s_report.go delete mode 100644 pkg/gen/pptasmessages/p_p_t_a_s_shipment.go delete mode 100644 pkg/handlers/pptasapi/internal/payloads/model_to_payload_test.go delete mode 100644 pkg/handlers/pptasapi/internal/payloads/payloads_test.go create mode 100644 pkg/handlers/pptasapi/moves.go delete mode 100644 pkg/handlers/pptasapi/pptas_report.go delete mode 100644 pkg/models/pptas_report.go delete mode 100644 pkg/services/mocks/PPTASReportListFetcher.go delete mode 100644 pkg/services/mocks/ReportListFetcher.go delete mode 100644 pkg/services/pptas_report.go delete mode 100644 pkg/services/pptas_report/pptas_report_list_fetcher.go delete mode 100644 pkg/services/pptas_report/pptas_report_list_fetcher_test.go delete mode 100644 pkg/services/pptas_report/pptas_report_service_test.go delete mode 100644 swagger-def/definitions/Crate.yaml create mode 100644 swagger-def/definitions/ListMove.yaml create mode 100644 swagger-def/definitions/ListMoves.yaml delete mode 100644 swagger-def/definitions/PPTASReport.yaml delete mode 100644 swagger-def/definitions/PPTASReports.yaml delete mode 100644 swagger-def/definitions/PPTASShipment.yaml diff --git a/cmd/pptas-api-client/main.go b/cmd/pptas-api-client/main.go index b633a2dd0c9..96b04d0f81c 100644 --- a/cmd/pptas-api-client/main.go +++ b/cmd/pptas-api-client/main.go @@ -34,15 +34,15 @@ func main() { } initRootFlags(root.PersistentFlags()) - PPTASReportsCommand := &cobra.Command{ + listMovesCommand := &cobra.Command{ Use: "list-moves", Short: "An optimized fetch for all moves available to Prime", Long: "Fetches moves that are available to Prime quickly, without all the data for nested objects.", - RunE: pptas.PPTASReports, + RunE: pptas.ListMoves, SilenceUsage: true, } - pptas.InitPPTASReportsFlags(PPTASReportsCommand.Flags()) - root.AddCommand(PPTASReportsCommand) + pptas.InitListMovesFlags(listMovesCommand.Flags()) + root.AddCommand(listMovesCommand) if err := root.Execute(); err != nil { panic(err) diff --git a/cmd/pptas-api-client/pptas/pptas_reports.go b/cmd/pptas-api-client/pptas/list_moves.go similarity index 82% rename from cmd/pptas-api-client/pptas/pptas_reports.go rename to cmd/pptas-api-client/pptas/list_moves.go index c0e9f3845f1..f5388e5c30d 100644 --- a/cmd/pptas-api-client/pptas/pptas_reports.go +++ b/cmd/pptas-api-client/pptas/list_moves.go @@ -17,13 +17,13 @@ import ( "github.com/transcom/mymove/pkg/gen/pptasmessages" ) -// InitPPTASReportsFlags declares which flags are enabled -func InitPPTASReportsFlags(flag *pflag.FlagSet) { +// InitListMovesFlags declares which flags are enabled +func InitListMovesFlags(flag *pflag.FlagSet) { flag.String(utils.SinceFlag, "", "Timestamp for filtering moves. Returns moves updated since this time.") flag.SortFlags = false } -func checkPPTASReportsConfig(v *viper.Viper, logger *log.Logger) error { +func checkListMovesConfig(v *viper.Viper, logger *log.Logger) error { err := utils.CheckRootConfig(v) if err != nil { logger.Fatal(err) @@ -32,8 +32,8 @@ func checkPPTASReportsConfig(v *viper.Viper, logger *log.Logger) error { return nil } -// PPTASReports creates a gateway and sends the request to the endpoint -func PPTASReports(cmd *cobra.Command, args []string) error { +// ListMoves creates a gateway and sends the request to the endpoint +func ListMoves(cmd *cobra.Command, args []string) error { v := viper.New() //Create the logger @@ -46,13 +46,13 @@ func PPTASReports(cmd *cobra.Command, args []string) error { } // Check the config before talking to the CAC - err := checkPPTASReportsConfig(v, logger) + err := checkListMovesConfig(v, logger) if err != nil { logger.Fatal(err) } // Get the since param, if any - var params moves.PptasReportsParams + var params moves.ListMovesParams since := v.GetString(utils.SinceFlag) if since != "" { sinceDateTime, sinceErr := strfmt.ParseDateTime(since) @@ -81,10 +81,10 @@ func PPTASReports(cmd *cobra.Command, args []string) error { // commands, so start with list moves for now wait := v.GetDuration(utils.WaitFlag) params.SetTimeout(wait) - var payload pptasmessages.PPTASReports + var payload pptasmessages.ListMoves // loop until we either time out or get a successful response for { - resp, err := primeGateway.Moves.PptasReports(¶ms) + resp, err := primeGateway.Moves.ListMoves(¶ms) if err != nil { currentTime := time.Now() if currentTime.Sub(startTime) > wait { diff --git a/pkg/gen/pptasapi/configure_mymove.go b/pkg/gen/pptasapi/configure_mymove.go index 607def1a89b..a9d77e45b46 100644 --- a/pkg/gen/pptasapi/configure_mymove.go +++ b/pkg/gen/pptasapi/configure_mymove.go @@ -38,9 +38,9 @@ func configureAPI(api *pptasoperations.MymoveAPI) http.Handler { api.JSONProducer = runtime.JSONProducer() - if api.MovesPptasReportsHandler == nil { - api.MovesPptasReportsHandler = moves.PptasReportsHandlerFunc(func(params moves.PptasReportsParams) middleware.Responder { - return middleware.NotImplemented("operation moves.PptasReports has not yet been implemented") + if api.MovesListMovesHandler == nil { + api.MovesListMovesHandler = moves.ListMovesHandlerFunc(func(params moves.ListMovesParams) middleware.Responder { + return middleware.NotImplemented("operation moves.ListMoves has not yet been implemented") }) } diff --git a/pkg/gen/pptasapi/embedded_spec.go b/pkg/gen/pptasapi/embedded_spec.go index c44e7013b60..e887968b732 100644 --- a/pkg/gen/pptasapi/embedded_spec.go +++ b/pkg/gen/pptasapi/embedded_spec.go @@ -45,15 +45,15 @@ func init() { "paths": { "/moves": { "get": { - "description": "Gets all reports that have been approved. Based on payment requests, includes data from Move, Shipments, Orders, and Transportation Accounting Codes and Lines of Accounting.\n", + "description": "Gets all moves that have been reviewed and approved by the TOO. The ` + "`" + `since` + "`" + ` parameter can be used to filter this\nlist down to only the moves that have been updated since the provided timestamp. A move will be considered\nupdated if the ` + "`" + `updatedAt` + "`" + ` timestamp on the move or on its orders, shipments, service items, or payment\nrequests, is later than the provided date and time.\n\n**WIP**: Include what causes moves to leave this list. Currently, once the ` + "`" + `availableToPrimeAt` + "`" + ` timestamp has\nbeen set, that move will always appear in this list.\n", "produces": [ "application/json" ], "tags": [ "moves" ], - "summary": "PPTASReports", - "operationId": "pptasReports", + "summary": "listMoves", + "operationId": "listMoves", "parameters": [ { "type": "string", @@ -65,9 +65,9 @@ func init() { ], "responses": { "200": { - "description": "Successfully retrieved pptas reports. A successful fetch might still return zero pptas reports.", + "description": "Successfully retrieved moves. A successful fetch might still return zero moves.", "schema": { - "$ref": "#/definitions/PPTASReports" + "$ref": "#/definitions/ListMoves" } }, "401": { @@ -84,205 +84,6 @@ func init() { } }, "definitions": { - "Address": { - "description": "A postal address", - "type": "object", - "required": [ - "streetAddress1", - "city", - "state", - "postalCode" - ], - "properties": { - "city": { - "type": "string", - "title": "City", - "example": "Anytown" - }, - "country": { - "type": "string", - "title": "Country", - "default": "USA", - "x-nullable": true, - "example": "USA" - }, - "county": { - "type": "string", - "title": "County", - "x-nullable": true, - "example": "LOS ANGELES" - }, - "eTag": { - "type": "string", - "readOnly": true - }, - "id": { - "type": "string", - "format": "uuid", - "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" - }, - "postalCode": { - "type": "string", - "format": "zip", - "title": "ZIP", - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "example": "90210" - }, - "state": { - "type": "string", - "title": "State", - "enum": [ - "AL", - "AK", - "AR", - "AZ", - "CA", - "CO", - "CT", - "DC", - "DE", - "FL", - "GA", - "HI", - "IA", - "ID", - "IL", - "IN", - "KS", - "KY", - "LA", - "MA", - "MD", - "ME", - "MI", - "MN", - "MO", - "MS", - "MT", - "NC", - "ND", - "NE", - "NH", - "NJ", - "NM", - "NV", - "NY", - "OH", - "OK", - "OR", - "PA", - "RI", - "SC", - "SD", - "TN", - "TX", - "UT", - "VA", - "VT", - "WA", - "WI", - "WV", - "WY" - ], - "x-display-value": { - "AK": "AK", - "AL": "AL", - "AR": "AR", - "AZ": "AZ", - "CA": "CA", - "CO": "CO", - "CT": "CT", - "DC": "DC", - "DE": "DE", - "FL": "FL", - "GA": "GA", - "HI": "HI", - "IA": "IA", - "ID": "ID", - "IL": "IL", - "IN": "IN", - "KS": "KS", - "KY": "KY", - "LA": "LA", - "MA": "MA", - "MD": "MD", - "ME": "ME", - "MI": "MI", - "MN": "MN", - "MO": "MO", - "MS": "MS", - "MT": "MT", - "NC": "NC", - "ND": "ND", - "NE": "NE", - "NH": "NH", - "NJ": "NJ", - "NM": "NM", - "NV": "NV", - "NY": "NY", - "OH": "OH", - "OK": "OK", - "OR": "OR", - "PA": "PA", - "RI": "RI", - "SC": "SC", - "SD": "SD", - "TN": "TN", - "TX": "TX", - "UT": "UT", - "VA": "VA", - "VT": "VT", - "WA": "WA", - "WI": "WI", - "WV": "WV", - "WY": "WY" - } - }, - "streetAddress1": { - "type": "string", - "title": "Street address 1", - "example": "123 Main Ave" - }, - "streetAddress2": { - "type": "string", - "title": "Street address 2", - "x-nullable": true, - "example": "Apartment 9000" - }, - "streetAddress3": { - "type": "string", - "title": "Address Line 3", - "x-nullable": true, - "example": "Montmârtre" - } - } - }, - "Affiliation": { - "description": "Military branch of service", - "type": "string", - "title": "Branch of service", - "enum": [ - "ARMY", - "NAVY", - "MARINES", - "AIR_FORCE", - "COAST_GUARD", - "SPACE_FORCE", - "NAVY_AND_MARINES", - "AIR_AND_SPACE_FORCE", - "OTHER" - ], - "x-display-value": { - "AIR_FORCE": "Air Force", - "ARMY": "Army", - "COAST_GUARD": "Coast Guard", - "MARINES": "Marine Corps", - "NAVY": "Navy", - "OTHER": "OTHER", - "SPACE_FORCE": "Space Force" - }, - "x-nullable": true - }, "ClientError": { "type": "object", "required": [ @@ -303,571 +104,62 @@ func init() { } } }, - "Crate": { - "description": "Crate object for PPTAS Reports", - "type": "object", - "properties": { - "crateDimensions": { - "$ref": "#/definitions/MTOServiceItemDimension" - }, - "description": { - "type": "string" - }, - "itemDimensions": { - "$ref": "#/definitions/MTOServiceItemDimension" - } - }, - "x-nullable": true - }, - "DimensionType": { - "description": "Describes a dimension type for a MTOServiceItemDimension.", - "type": "string", - "enum": [ - "ITEM", - "CRATE" - ] - }, - "MTOServiceItemDimension": { - "description": "Describes a dimension object for the MTOServiceItem.", + "ListMove": { + "description": "An abbreviated definition for a move, without all the nested information (shipments, service items, etc). Used to fetch a list of moves more efficiently.\n", "type": "object", "properties": { - "height": { - "description": "Height in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - }, - "id": { - "type": "string", - "format": "uuid", - "example": "1f2270c7-7166-40ae-981e-b200ebdf3054" - }, - "length": { - "description": "Length in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - }, - "type": { - "$ref": "#/definitions/DimensionType" - }, - "width": { - "description": "Width in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - } - } - }, - "PPTASReport": { - "description": "Report for Navy PPTAS, contains information about Service Members, Orders, Move Task Orders, Shipments, and Payment Requests.\n", - "type": "object", - "properties": { - "address": { - "$ref": "#/definitions/Address" - }, - "affiliation": { - "$ref": "#/definitions/Affiliation" - }, - "counseledDate": { - "type": "string", - "format": "date" - }, - "depCD": { - "description": "Dependent Code", - "type": "boolean", - "x-nullable": true - }, - "destinationGbloc": { - "type": "string", - "pattern": "^[A-Z]{4}$", - "x-nullable": true - }, - "edipi": { - "type": "string" - }, - "emailPrimary": { - "type": "string", - "example": "a@b.com" - }, - "emailSecondary": { - "type": "string", - "x-nullable": true - }, - "entitlementWeight": { - "type": "integer", - "x-nullable": true - }, - "financialReviewFlag": { - "type": "boolean", - "x-nullable": true - }, - "financialReviewRemarks": { - "type": "string", - "x-nullable": true - }, - "firstName": { - "type": "string", - "example": "Bob" - }, - "lastName": { - "type": "string", - "example": "Job" - }, - "middleInitial": { + "availableToPrimeAt": { "type": "string", + "format": "date-time", "x-nullable": true, - "example": "G" - }, - "orderNumber": { - "description": "not to be confused with Orders Number", - "type": "string", - "x-nullable": true, - "example": "030-00362" - }, - "ordersDate": { - "type": "string", - "format": "date-time" - }, - "ordersNumber": { - "type": "string" - }, - "ordersType": { - "type": "string" + "readOnly": true }, - "originGbloc": { + "createdAt": { "type": "string", - "pattern": "^[A-Z]{4}$", - "x-nullable": true + "format": "date-time", + "readOnly": true }, - "payGrade": { + "eTag": { "type": "string", - "title": "grade", - "enum": [ - "E_1", - "E_2", - "E_3", - "E_4", - "E_5", - "E_6", - "E_7", - "E_8", - "E_9", - "E_9_SPECIAL_SENIOR_ENLISTED", - "O_1_ACADEMY_GRADUATE", - "O_2", - "O_3", - "O_4", - "O_5", - "O_6", - "O_7", - "O_8", - "O_9", - "O_10", - "W_1", - "W_2", - "W_3", - "W_4", - "W_5", - "AVIATION_CADET", - "CIVILIAN_EMPLOYEE", - "ACADEMY_CADET", - "MIDSHIPMAN" - ], - "x-display-value": { - "ACADEMY_CADET": "Service Academy Cadet", - "AVIATION_CADET": "Aviation Cadet", - "CIVILIAN_EMPLOYEE": "Civilian Employee", - "E_1": "E-1", - "E_2": "E-2", - "E_3": "E-3", - "E_4": "E-4", - "E_5": "E-5", - "E_6": "E-6", - "E_7": "E-7", - "E_8": "E-8", - "E_9": "E-9", - "E_9_SPECIAL_SENIOR_ENLISTED": "E-9 (Special Senior Enlisted)", - "MIDSHIPMAN": "Midshipman", - "O_10": "O-10", - "O_1_ACADEMY_GRADUATE": "O-1 or Service Academy Graduate", - "O_2": "O-2", - "O_3": "O-3", - "O_4": "O-4", - "O_5": "O-5", - "O_6": "O-6", - "O_7": "O-7", - "O_8": "O-8", - "O_9": "O-9", - "W_1": "W-1", - "W_2": "W-2", - "W_3": "W-3", - "W_4": "W-4", - "W_5": "W-5" - }, - "x-nullable": true - }, - "phonePrimary": { - "type": "string" + "readOnly": true }, - "phoneSecondary": { + "id": { "type": "string", - "x-nullable": true + "format": "uuid", + "example": "1f2270c7-7166-40ae-981e-b200ebdf3054" }, - "scac": { + "moveCode": { "type": "string", - "x-nullable": true, - "example": "AGFM" - }, - "shipmentNum": { - "description": "Number of shipments", - "type": "integer" + "readOnly": true, + "example": "HYXFJF" }, - "shipments": { - "type": "array", - "items": { - "$ref": "#/definitions/PPTASShipment" - } - }, - "tac": { - "description": "Transportation Accounting Code", + "orderID": { "type": "string", - "x-nullable": true + "format": "uuid", + "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" }, - "transmitCD": { - "description": "Transmit Code", + "ppmType": { "type": "string", - "x-nullable": true + "enum": [ + "FULL", + "PARTIAL" + ] }, - "travelClassCode": { + "referenceId": { "type": "string", - "example": "PCS" + "example": "1001-3456" }, - "travelType": { - "description": "Travel Type", + "updatedAt": { "type": "string", - "example": "Shipment of HHG Permitted" - }, - "weightAuthorized": { - "type": "number", - "format": "double", - "x-nullable": true + "format": "date-time", + "readOnly": true } } }, - "PPTASReports": { + "ListMoves": { "type": "array", "items": { - "$ref": "#/definitions/PPTASReport" - } - }, - "PPTASShipment": { - "description": "Shipment definition used for PPTAS reports.\n", - "properties": { - "aaa": { - "description": "LoaTrnsnID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "actualOriginNetWeight": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "appro": { - "description": "Appropriation", - "type": "string", - "x-nullable": true - }, - "bcn": { - "description": "LoaSbaltmtRcpntID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "costCD": { - "description": "LoaPgmElmntID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "counselingFeeTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "cratingDimensions": { - "type": "array", - "items": { - "$ref": "#/definitions/Crate" - } - }, - "cratingTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "dd2278IssueDate": { - "description": "Counseling Date", - "type": "string", - "format": "date" - }, - "ddcd": { - "description": "LoaDptID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "deliveryDate": { - "type": "string", - "format": "date" - }, - "destinationAddress": { - "$ref": "#/definitions/Address" - }, - "destinationPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "destinationReweighNetWeight": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "fiscalYear": { - "type": "string", - "x-nullable": true - }, - "invoicePaidAmt": { - "description": "Invoice Paid Amounts", - "type": "number", - "format": "double", - "x-nullable": true - }, - "linehaulFuelTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "linehaulTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "loa": { - "description": "Line of Accounting", - "type": "string", - "x-nullable": true - }, - "miles": { - "type": "integer" - }, - "moveDate": { - "type": "string", - "format": "date", - "x-nullable": true - }, - "moveManagementFeeTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "netWeight": { - "type": "integer", - "x-nullable": true - }, - "objClass": { - "description": "LoaAlltSnID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "originAddress": { - "$ref": "#/definitions/Address" - }, - "originPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "paa": { - "description": "LoaDocID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "packingPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "paidDate": { - "type": "string", - "format": "date", - "x-nullable": true - }, - "pbpAnde": { - "description": "Pro Gear", - "type": "number", - "format": "double", - "x-nullable": true - }, - "pickupDate": { - "type": "string", - "format": "date" - }, - "ppmDestPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmFuelRateAdjTotal": { - "description": "Personally Procured Move Fuel Rate Adjusted total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmLinehaul": { - "description": "Personally Procured Move Linehaul total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmOriginPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmPacking": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmStorage": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmUnpacking": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "shipmentId": { - "type": "string", - "format": "uuid" - }, - "shipmentType": { - "type": "string" - }, - "shuttleTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDeliveryTotal": { - "description": "Storage in Transit delivery total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestAddlDaysTotal": { - "description": "Additional day of Destination Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestFirstDayTotal": { - "description": "First day of Destination Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestFuelSurcharge": { - "description": "Storage in Transit destination total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitInDate": { - "description": "Storage in Transit In Date", - "type": "string", - "format": "date", - "x-nullable": true - }, - "sitOriginAddlDaysTotal": { - "description": "Additional day of Origin Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOriginFirstDayTotal": { - "description": "First day of Origin Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOriginFuelSurcharge": { - "description": "Storage in Transit origin fuel total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOutDate": { - "description": "Storage in Transit Out Date", - "type": "string", - "format": "date", - "x-nullable": true - }, - "sitPickupTotal": { - "description": "Storage in Transit pickup total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitType": { - "description": "Storage in Transit type", - "type": "string", - "x-nullable": true, - "example": "Destination" - }, - "subAllotCD": { - "description": "LoaInstlAcntgActID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "subhead": { - "description": "LoaObjClsID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "travelAdvance": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "typeCD": { - "description": "LoaJbOrdNm in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "uncratingTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "unpackingPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "weightEstimate": { - "description": "Total weight estimate", - "type": "number", - "format": "double", - "x-nullable": true - } + "$ref": "#/definitions/ListMove" } } }, @@ -919,15 +211,15 @@ func init() { "paths": { "/moves": { "get": { - "description": "Gets all reports that have been approved. Based on payment requests, includes data from Move, Shipments, Orders, and Transportation Accounting Codes and Lines of Accounting.\n", + "description": "Gets all moves that have been reviewed and approved by the TOO. The ` + "`" + `since` + "`" + ` parameter can be used to filter this\nlist down to only the moves that have been updated since the provided timestamp. A move will be considered\nupdated if the ` + "`" + `updatedAt` + "`" + ` timestamp on the move or on its orders, shipments, service items, or payment\nrequests, is later than the provided date and time.\n\n**WIP**: Include what causes moves to leave this list. Currently, once the ` + "`" + `availableToPrimeAt` + "`" + ` timestamp has\nbeen set, that move will always appear in this list.\n", "produces": [ "application/json" ], "tags": [ "moves" ], - "summary": "PPTASReports", - "operationId": "pptasReports", + "summary": "listMoves", + "operationId": "listMoves", "parameters": [ { "type": "string", @@ -939,9 +231,9 @@ func init() { ], "responses": { "200": { - "description": "Successfully retrieved pptas reports. A successful fetch might still return zero pptas reports.", + "description": "Successfully retrieved moves. A successful fetch might still return zero moves.", "schema": { - "$ref": "#/definitions/PPTASReports" + "$ref": "#/definitions/ListMoves" } }, "401": { @@ -967,205 +259,6 @@ func init() { } }, "definitions": { - "Address": { - "description": "A postal address", - "type": "object", - "required": [ - "streetAddress1", - "city", - "state", - "postalCode" - ], - "properties": { - "city": { - "type": "string", - "title": "City", - "example": "Anytown" - }, - "country": { - "type": "string", - "title": "Country", - "default": "USA", - "x-nullable": true, - "example": "USA" - }, - "county": { - "type": "string", - "title": "County", - "x-nullable": true, - "example": "LOS ANGELES" - }, - "eTag": { - "type": "string", - "readOnly": true - }, - "id": { - "type": "string", - "format": "uuid", - "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" - }, - "postalCode": { - "type": "string", - "format": "zip", - "title": "ZIP", - "pattern": "^(\\d{5}([\\-]\\d{4})?)$", - "example": "90210" - }, - "state": { - "type": "string", - "title": "State", - "enum": [ - "AL", - "AK", - "AR", - "AZ", - "CA", - "CO", - "CT", - "DC", - "DE", - "FL", - "GA", - "HI", - "IA", - "ID", - "IL", - "IN", - "KS", - "KY", - "LA", - "MA", - "MD", - "ME", - "MI", - "MN", - "MO", - "MS", - "MT", - "NC", - "ND", - "NE", - "NH", - "NJ", - "NM", - "NV", - "NY", - "OH", - "OK", - "OR", - "PA", - "RI", - "SC", - "SD", - "TN", - "TX", - "UT", - "VA", - "VT", - "WA", - "WI", - "WV", - "WY" - ], - "x-display-value": { - "AK": "AK", - "AL": "AL", - "AR": "AR", - "AZ": "AZ", - "CA": "CA", - "CO": "CO", - "CT": "CT", - "DC": "DC", - "DE": "DE", - "FL": "FL", - "GA": "GA", - "HI": "HI", - "IA": "IA", - "ID": "ID", - "IL": "IL", - "IN": "IN", - "KS": "KS", - "KY": "KY", - "LA": "LA", - "MA": "MA", - "MD": "MD", - "ME": "ME", - "MI": "MI", - "MN": "MN", - "MO": "MO", - "MS": "MS", - "MT": "MT", - "NC": "NC", - "ND": "ND", - "NE": "NE", - "NH": "NH", - "NJ": "NJ", - "NM": "NM", - "NV": "NV", - "NY": "NY", - "OH": "OH", - "OK": "OK", - "OR": "OR", - "PA": "PA", - "RI": "RI", - "SC": "SC", - "SD": "SD", - "TN": "TN", - "TX": "TX", - "UT": "UT", - "VA": "VA", - "VT": "VT", - "WA": "WA", - "WI": "WI", - "WV": "WV", - "WY": "WY" - } - }, - "streetAddress1": { - "type": "string", - "title": "Street address 1", - "example": "123 Main Ave" - }, - "streetAddress2": { - "type": "string", - "title": "Street address 2", - "x-nullable": true, - "example": "Apartment 9000" - }, - "streetAddress3": { - "type": "string", - "title": "Address Line 3", - "x-nullable": true, - "example": "Montmârtre" - } - } - }, - "Affiliation": { - "description": "Military branch of service", - "type": "string", - "title": "Branch of service", - "enum": [ - "ARMY", - "NAVY", - "MARINES", - "AIR_FORCE", - "COAST_GUARD", - "SPACE_FORCE", - "NAVY_AND_MARINES", - "AIR_AND_SPACE_FORCE", - "OTHER" - ], - "x-display-value": { - "AIR_FORCE": "Air Force", - "ARMY": "Army", - "COAST_GUARD": "Coast Guard", - "MARINES": "Marine Corps", - "NAVY": "Navy", - "OTHER": "OTHER", - "SPACE_FORCE": "Space Force" - }, - "x-nullable": true - }, "ClientError": { "type": "object", "required": [ @@ -1186,571 +279,62 @@ func init() { } } }, - "Crate": { - "description": "Crate object for PPTAS Reports", - "type": "object", - "properties": { - "crateDimensions": { - "$ref": "#/definitions/MTOServiceItemDimension" - }, - "description": { - "type": "string" - }, - "itemDimensions": { - "$ref": "#/definitions/MTOServiceItemDimension" - } - }, - "x-nullable": true - }, - "DimensionType": { - "description": "Describes a dimension type for a MTOServiceItemDimension.", - "type": "string", - "enum": [ - "ITEM", - "CRATE" - ] - }, - "MTOServiceItemDimension": { - "description": "Describes a dimension object for the MTOServiceItem.", + "ListMove": { + "description": "An abbreviated definition for a move, without all the nested information (shipments, service items, etc). Used to fetch a list of moves more efficiently.\n", "type": "object", "properties": { - "height": { - "description": "Height in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - }, - "id": { - "type": "string", - "format": "uuid", - "example": "1f2270c7-7166-40ae-981e-b200ebdf3054" - }, - "length": { - "description": "Length in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - }, - "type": { - "$ref": "#/definitions/DimensionType" - }, - "width": { - "description": "Width in thousandth inches. 1000 thou = 1 inch.", - "type": "integer", - "format": "int32", - "example": 1000 - } - } - }, - "PPTASReport": { - "description": "Report for Navy PPTAS, contains information about Service Members, Orders, Move Task Orders, Shipments, and Payment Requests.\n", - "type": "object", - "properties": { - "address": { - "$ref": "#/definitions/Address" - }, - "affiliation": { - "$ref": "#/definitions/Affiliation" - }, - "counseledDate": { - "type": "string", - "format": "date" - }, - "depCD": { - "description": "Dependent Code", - "type": "boolean", - "x-nullable": true - }, - "destinationGbloc": { - "type": "string", - "pattern": "^[A-Z]{4}$", - "x-nullable": true - }, - "edipi": { - "type": "string" - }, - "emailPrimary": { - "type": "string", - "example": "a@b.com" - }, - "emailSecondary": { - "type": "string", - "x-nullable": true - }, - "entitlementWeight": { - "type": "integer", - "x-nullable": true - }, - "financialReviewFlag": { - "type": "boolean", - "x-nullable": true - }, - "financialReviewRemarks": { - "type": "string", - "x-nullable": true - }, - "firstName": { - "type": "string", - "example": "Bob" - }, - "lastName": { - "type": "string", - "example": "Job" - }, - "middleInitial": { + "availableToPrimeAt": { "type": "string", + "format": "date-time", "x-nullable": true, - "example": "G" - }, - "orderNumber": { - "description": "not to be confused with Orders Number", - "type": "string", - "x-nullable": true, - "example": "030-00362" - }, - "ordersDate": { - "type": "string", - "format": "date-time" - }, - "ordersNumber": { - "type": "string" - }, - "ordersType": { - "type": "string" + "readOnly": true }, - "originGbloc": { + "createdAt": { "type": "string", - "pattern": "^[A-Z]{4}$", - "x-nullable": true + "format": "date-time", + "readOnly": true }, - "payGrade": { + "eTag": { "type": "string", - "title": "grade", - "enum": [ - "E_1", - "E_2", - "E_3", - "E_4", - "E_5", - "E_6", - "E_7", - "E_8", - "E_9", - "E_9_SPECIAL_SENIOR_ENLISTED", - "O_1_ACADEMY_GRADUATE", - "O_2", - "O_3", - "O_4", - "O_5", - "O_6", - "O_7", - "O_8", - "O_9", - "O_10", - "W_1", - "W_2", - "W_3", - "W_4", - "W_5", - "AVIATION_CADET", - "CIVILIAN_EMPLOYEE", - "ACADEMY_CADET", - "MIDSHIPMAN" - ], - "x-display-value": { - "ACADEMY_CADET": "Service Academy Cadet", - "AVIATION_CADET": "Aviation Cadet", - "CIVILIAN_EMPLOYEE": "Civilian Employee", - "E_1": "E-1", - "E_2": "E-2", - "E_3": "E-3", - "E_4": "E-4", - "E_5": "E-5", - "E_6": "E-6", - "E_7": "E-7", - "E_8": "E-8", - "E_9": "E-9", - "E_9_SPECIAL_SENIOR_ENLISTED": "E-9 (Special Senior Enlisted)", - "MIDSHIPMAN": "Midshipman", - "O_10": "O-10", - "O_1_ACADEMY_GRADUATE": "O-1 or Service Academy Graduate", - "O_2": "O-2", - "O_3": "O-3", - "O_4": "O-4", - "O_5": "O-5", - "O_6": "O-6", - "O_7": "O-7", - "O_8": "O-8", - "O_9": "O-9", - "W_1": "W-1", - "W_2": "W-2", - "W_3": "W-3", - "W_4": "W-4", - "W_5": "W-5" - }, - "x-nullable": true - }, - "phonePrimary": { - "type": "string" + "readOnly": true }, - "phoneSecondary": { + "id": { "type": "string", - "x-nullable": true + "format": "uuid", + "example": "1f2270c7-7166-40ae-981e-b200ebdf3054" }, - "scac": { + "moveCode": { "type": "string", - "x-nullable": true, - "example": "AGFM" - }, - "shipmentNum": { - "description": "Number of shipments", - "type": "integer" + "readOnly": true, + "example": "HYXFJF" }, - "shipments": { - "type": "array", - "items": { - "$ref": "#/definitions/PPTASShipment" - } - }, - "tac": { - "description": "Transportation Accounting Code", + "orderID": { "type": "string", - "x-nullable": true + "format": "uuid", + "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" }, - "transmitCD": { - "description": "Transmit Code", + "ppmType": { "type": "string", - "x-nullable": true + "enum": [ + "FULL", + "PARTIAL" + ] }, - "travelClassCode": { + "referenceId": { "type": "string", - "example": "PCS" + "example": "1001-3456" }, - "travelType": { - "description": "Travel Type", + "updatedAt": { "type": "string", - "example": "Shipment of HHG Permitted" - }, - "weightAuthorized": { - "type": "number", - "format": "double", - "x-nullable": true + "format": "date-time", + "readOnly": true } } }, - "PPTASReports": { + "ListMoves": { "type": "array", "items": { - "$ref": "#/definitions/PPTASReport" - } - }, - "PPTASShipment": { - "description": "Shipment definition used for PPTAS reports.\n", - "properties": { - "aaa": { - "description": "LoaTrnsnID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "actualOriginNetWeight": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "appro": { - "description": "Appropriation", - "type": "string", - "x-nullable": true - }, - "bcn": { - "description": "LoaSbaltmtRcpntID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "costCD": { - "description": "LoaPgmElmntID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "counselingFeeTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "cratingDimensions": { - "type": "array", - "items": { - "$ref": "#/definitions/Crate" - } - }, - "cratingTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "dd2278IssueDate": { - "description": "Counseling Date", - "type": "string", - "format": "date" - }, - "ddcd": { - "description": "LoaDptID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "deliveryDate": { - "type": "string", - "format": "date" - }, - "destinationAddress": { - "$ref": "#/definitions/Address" - }, - "destinationPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "destinationReweighNetWeight": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "fiscalYear": { - "type": "string", - "x-nullable": true - }, - "invoicePaidAmt": { - "description": "Invoice Paid Amounts", - "type": "number", - "format": "double", - "x-nullable": true - }, - "linehaulFuelTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "linehaulTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "loa": { - "description": "Line of Accounting", - "type": "string", - "x-nullable": true - }, - "miles": { - "type": "integer" - }, - "moveDate": { - "type": "string", - "format": "date", - "x-nullable": true - }, - "moveManagementFeeTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "netWeight": { - "type": "integer", - "x-nullable": true - }, - "objClass": { - "description": "LoaAlltSnID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "originAddress": { - "$ref": "#/definitions/Address" - }, - "originPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "paa": { - "description": "LoaDocID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "packingPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "paidDate": { - "type": "string", - "format": "date", - "x-nullable": true - }, - "pbpAnde": { - "description": "Pro Gear", - "type": "number", - "format": "double", - "x-nullable": true - }, - "pickupDate": { - "type": "string", - "format": "date" - }, - "ppmDestPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmFuelRateAdjTotal": { - "description": "Personally Procured Move Fuel Rate Adjusted total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmLinehaul": { - "description": "Personally Procured Move Linehaul total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmOriginPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmPacking": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmStorage": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "ppmUnpacking": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "shipmentId": { - "type": "string", - "format": "uuid" - }, - "shipmentType": { - "type": "string" - }, - "shuttleTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDeliveryTotal": { - "description": "Storage in Transit delivery total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestAddlDaysTotal": { - "description": "Additional day of Destination Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestFirstDayTotal": { - "description": "First day of Destination Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitDestFuelSurcharge": { - "description": "Storage in Transit destination total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitInDate": { - "description": "Storage in Transit In Date", - "type": "string", - "format": "date", - "x-nullable": true - }, - "sitOriginAddlDaysTotal": { - "description": "Additional day of Origin Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOriginFirstDayTotal": { - "description": "First day of Origin Storage in Transit cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOriginFuelSurcharge": { - "description": "Storage in Transit origin fuel total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitOutDate": { - "description": "Storage in Transit Out Date", - "type": "string", - "format": "date", - "x-nullable": true - }, - "sitPickupTotal": { - "description": "Storage in Transit pickup total cost", - "type": "number", - "format": "double", - "x-nullable": true - }, - "sitType": { - "description": "Storage in Transit type", - "type": "string", - "x-nullable": true, - "example": "Destination" - }, - "subAllotCD": { - "description": "LoaInstlAcntgActID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "subhead": { - "description": "LoaObjClsID in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "travelAdvance": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "typeCD": { - "description": "LoaJbOrdNm in lines_of_accounting", - "type": "string", - "x-nullable": true - }, - "uncratingTotal": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "unpackingPrice": { - "type": "number", - "format": "double", - "x-nullable": true - }, - "weightEstimate": { - "description": "Total weight estimate", - "type": "number", - "format": "double", - "x-nullable": true - } + "$ref": "#/definitions/ListMove" } } }, diff --git a/pkg/gen/pptasapi/pptasoperations/moves/list_moves.go b/pkg/gen/pptasapi/pptasoperations/moves/list_moves.go new file mode 100644 index 00000000000..6062de374fa --- /dev/null +++ b/pkg/gen/pptasapi/pptasoperations/moves/list_moves.go @@ -0,0 +1,64 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package moves + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// ListMovesHandlerFunc turns a function with the right signature into a list moves handler +type ListMovesHandlerFunc func(ListMovesParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn ListMovesHandlerFunc) Handle(params ListMovesParams) middleware.Responder { + return fn(params) +} + +// ListMovesHandler interface for that can handle valid list moves params +type ListMovesHandler interface { + Handle(ListMovesParams) middleware.Responder +} + +// NewListMoves creates a new http.Handler for the list moves operation +func NewListMoves(ctx *middleware.Context, handler ListMovesHandler) *ListMoves { + return &ListMoves{Context: ctx, Handler: handler} +} + +/* + ListMoves swagger:route GET /moves moves listMoves + +listMoves + +Gets all moves that have been reviewed and approved by the TOO. The `since` parameter can be used to filter this +list down to only the moves that have been updated since the provided timestamp. A move will be considered +updated if the `updatedAt` timestamp on the move or on its orders, shipments, service items, or payment +requests, is later than the provided date and time. + +**WIP**: Include what causes moves to leave this list. Currently, once the `availableToPrimeAt` timestamp has +been set, that move will always appear in this list. +*/ +type ListMoves struct { + Context *middleware.Context + Handler ListMovesHandler +} + +func (o *ListMoves) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewListMovesParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_parameters.go b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_parameters.go similarity index 76% rename from pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_parameters.go rename to pkg/gen/pptasapi/pptasoperations/moves/list_moves_parameters.go index 9ac62b2473e..7d92acc4d9a 100644 --- a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_parameters.go +++ b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_parameters.go @@ -15,19 +15,19 @@ import ( "github.com/go-openapi/validate" ) -// NewPptasReportsParams creates a new PptasReportsParams object +// NewListMovesParams creates a new ListMovesParams object // // There are no default values defined in the spec. -func NewPptasReportsParams() PptasReportsParams { +func NewListMovesParams() ListMovesParams { - return PptasReportsParams{} + return ListMovesParams{} } -// PptasReportsParams contains all the bound params for the pptas reports operation +// ListMovesParams contains all the bound params for the list moves operation // typically these are obtained from a http.Request // -// swagger:parameters pptasReports -type PptasReportsParams struct { +// swagger:parameters listMoves +type ListMovesParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` @@ -41,8 +41,8 @@ type PptasReportsParams struct { // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface // for simple values it will use straight method calls. // -// To ensure default values, the struct must have been initialized with NewPptasReportsParams() beforehand. -func (o *PptasReportsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { +// To ensure default values, the struct must have been initialized with NewListMovesParams() beforehand. +func (o *ListMovesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r @@ -60,7 +60,7 @@ func (o *PptasReportsParams) BindRequest(r *http.Request, route *middleware.Matc } // bindSince binds and validates parameter Since from query. -func (o *PptasReportsParams) bindSince(rawData []string, hasKey bool, formats strfmt.Registry) error { +func (o *ListMovesParams) bindSince(rawData []string, hasKey bool, formats strfmt.Registry) error { var raw string if len(rawData) > 0 { raw = rawData[len(rawData)-1] @@ -88,7 +88,7 @@ func (o *PptasReportsParams) bindSince(rawData []string, hasKey bool, formats st } // validateSince carries on validations for parameter Since -func (o *PptasReportsParams) validateSince(formats strfmt.Registry) error { +func (o *ListMovesParams) validateSince(formats strfmt.Registry) error { if err := validate.FormatOf("since", "query", "date-time", o.Since.String(), formats); err != nil { return err diff --git a/pkg/gen/pptasapi/pptasoperations/moves/list_moves_responses.go b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_responses.go new file mode 100644 index 00000000000..80649ff2982 --- /dev/null +++ b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_responses.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package moves + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/transcom/mymove/pkg/gen/pptasmessages" +) + +// ListMovesOKCode is the HTTP code returned for type ListMovesOK +const ListMovesOKCode int = 200 + +/* +ListMovesOK Successfully retrieved moves. A successful fetch might still return zero moves. + +swagger:response listMovesOK +*/ +type ListMovesOK struct { + + /* + In: Body + */ + Payload pptasmessages.ListMoves `json:"body,omitempty"` +} + +// NewListMovesOK creates ListMovesOK with default headers values +func NewListMovesOK() *ListMovesOK { + + return &ListMovesOK{} +} + +// WithPayload adds the payload to the list moves o k response +func (o *ListMovesOK) WithPayload(payload pptasmessages.ListMoves) *ListMovesOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list moves o k response +func (o *ListMovesOK) SetPayload(payload pptasmessages.ListMoves) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListMovesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + payload := o.Payload + if payload == nil { + // return empty array + payload = pptasmessages.ListMoves{} + } + + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } +} + +// ListMovesUnauthorizedCode is the HTTP code returned for type ListMovesUnauthorized +const ListMovesUnauthorizedCode int = 401 + +/* +ListMovesUnauthorized The request was denied. + +swagger:response listMovesUnauthorized +*/ +type ListMovesUnauthorized struct { + + /* + In: Body + */ + Payload *pptasmessages.ClientError `json:"body,omitempty"` +} + +// NewListMovesUnauthorized creates ListMovesUnauthorized with default headers values +func NewListMovesUnauthorized() *ListMovesUnauthorized { + + return &ListMovesUnauthorized{} +} + +// WithPayload adds the payload to the list moves unauthorized response +func (o *ListMovesUnauthorized) WithPayload(payload *pptasmessages.ClientError) *ListMovesUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list moves unauthorized response +func (o *ListMovesUnauthorized) SetPayload(payload *pptasmessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListMovesUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListMovesForbiddenCode is the HTTP code returned for type ListMovesForbidden +const ListMovesForbiddenCode int = 403 + +/* +ListMovesForbidden The request was denied. + +swagger:response listMovesForbidden +*/ +type ListMovesForbidden struct { + + /* + In: Body + */ + Payload *pptasmessages.ClientError `json:"body,omitempty"` +} + +// NewListMovesForbidden creates ListMovesForbidden with default headers values +func NewListMovesForbidden() *ListMovesForbidden { + + return &ListMovesForbidden{} +} + +// WithPayload adds the payload to the list moves forbidden response +func (o *ListMovesForbidden) WithPayload(payload *pptasmessages.ClientError) *ListMovesForbidden { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list moves forbidden response +func (o *ListMovesForbidden) SetPayload(payload *pptasmessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListMovesForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(403) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListMovesInternalServerErrorCode is the HTTP code returned for type ListMovesInternalServerError +const ListMovesInternalServerErrorCode int = 500 + +/* +ListMovesInternalServerError An unexpected error has occurred in the server. + +swagger:response listMovesInternalServerError +*/ +type ListMovesInternalServerError struct { + + /* + In: Body + */ + Payload *pptasmessages.ClientError `json:"body,omitempty"` +} + +// NewListMovesInternalServerError creates ListMovesInternalServerError with default headers values +func NewListMovesInternalServerError() *ListMovesInternalServerError { + + return &ListMovesInternalServerError{} +} + +// WithPayload adds the payload to the list moves internal server error response +func (o *ListMovesInternalServerError) WithPayload(payload *pptasmessages.ClientError) *ListMovesInternalServerError { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list moves internal server error response +func (o *ListMovesInternalServerError) SetPayload(payload *pptasmessages.ClientError) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListMovesInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(500) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_urlbuilder.go b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_urlbuilder.go similarity index 73% rename from pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_urlbuilder.go rename to pkg/gen/pptasapi/pptasoperations/moves/list_moves_urlbuilder.go index 584d9120bea..c6dc91a2b6c 100644 --- a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_urlbuilder.go +++ b/pkg/gen/pptasapi/pptasoperations/moves/list_moves_urlbuilder.go @@ -13,8 +13,8 @@ import ( "github.com/go-openapi/strfmt" ) -// PptasReportsURL generates an URL for the pptas reports operation -type PptasReportsURL struct { +// ListMovesURL generates an URL for the list moves operation +type ListMovesURL struct { Since *strfmt.DateTime _basePath string @@ -25,7 +25,7 @@ type PptasReportsURL struct { // WithBasePath sets the base path for this url builder, only required when it's different from the // base path specified in the swagger spec. // When the value of the base path is an empty string -func (o *PptasReportsURL) WithBasePath(bp string) *PptasReportsURL { +func (o *ListMovesURL) WithBasePath(bp string) *ListMovesURL { o.SetBasePath(bp) return o } @@ -33,12 +33,12 @@ func (o *PptasReportsURL) WithBasePath(bp string) *PptasReportsURL { // SetBasePath sets the base path for this url builder, only required when it's different from the // base path specified in the swagger spec. // When the value of the base path is an empty string -func (o *PptasReportsURL) SetBasePath(bp string) { +func (o *ListMovesURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string -func (o *PptasReportsURL) Build() (*url.URL, error) { +func (o *ListMovesURL) Build() (*url.URL, error) { var _result url.URL var _path = "/moves" @@ -65,7 +65,7 @@ func (o *PptasReportsURL) Build() (*url.URL, error) { } // Must is a helper function to panic when the url builder returns an error -func (o *PptasReportsURL) Must(u *url.URL, err error) *url.URL { +func (o *ListMovesURL) Must(u *url.URL, err error) *url.URL { if err != nil { panic(err) } @@ -76,17 +76,17 @@ func (o *PptasReportsURL) Must(u *url.URL, err error) *url.URL { } // String returns the string representation of the path with query string -func (o *PptasReportsURL) String() string { +func (o *ListMovesURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string -func (o *PptasReportsURL) BuildFull(scheme, host string) (*url.URL, error) { +func (o *ListMovesURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { - return nil, errors.New("scheme is required for a full url on PptasReportsURL") + return nil, errors.New("scheme is required for a full url on ListMovesURL") } if host == "" { - return nil, errors.New("host is required for a full url on PptasReportsURL") + return nil, errors.New("host is required for a full url on ListMovesURL") } base, err := o.Build() @@ -100,6 +100,6 @@ func (o *PptasReportsURL) BuildFull(scheme, host string) (*url.URL, error) { } // StringFull returns the string representation of a complete url -func (o *PptasReportsURL) StringFull(scheme, host string) string { +func (o *ListMovesURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } diff --git a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports.go b/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports.go deleted file mode 100644 index aeafb627fca..00000000000 --- a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package moves - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime/middleware" -) - -// PptasReportsHandlerFunc turns a function with the right signature into a pptas reports handler -type PptasReportsHandlerFunc func(PptasReportsParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn PptasReportsHandlerFunc) Handle(params PptasReportsParams) middleware.Responder { - return fn(params) -} - -// PptasReportsHandler interface for that can handle valid pptas reports params -type PptasReportsHandler interface { - Handle(PptasReportsParams) middleware.Responder -} - -// NewPptasReports creates a new http.Handler for the pptas reports operation -func NewPptasReports(ctx *middleware.Context, handler PptasReportsHandler) *PptasReports { - return &PptasReports{Context: ctx, Handler: handler} -} - -/* - PptasReports swagger:route GET /moves moves pptasReports - -# PPTASReports - -Gets all reports that have been approved. Based on payment requests, includes data from Move, Shipments, Orders, and Transportation Accounting Codes and Lines of Accounting. -*/ -type PptasReports struct { - Context *middleware.Context - Handler PptasReportsHandler -} - -func (o *PptasReports) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewPptasReportsParams() - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_responses.go b/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_responses.go deleted file mode 100644 index 2cf8636b9f1..00000000000 --- a/pkg/gen/pptasapi/pptasoperations/moves/pptas_reports_responses.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package moves - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - "github.com/transcom/mymove/pkg/gen/pptasmessages" -) - -// PptasReportsOKCode is the HTTP code returned for type PptasReportsOK -const PptasReportsOKCode int = 200 - -/* -PptasReportsOK Successfully retrieved pptas reports. A successful fetch might still return zero pptas reports. - -swagger:response pptasReportsOK -*/ -type PptasReportsOK struct { - - /* - In: Body - */ - Payload pptasmessages.PPTASReports `json:"body,omitempty"` -} - -// NewPptasReportsOK creates PptasReportsOK with default headers values -func NewPptasReportsOK() *PptasReportsOK { - - return &PptasReportsOK{} -} - -// WithPayload adds the payload to the pptas reports o k response -func (o *PptasReportsOK) WithPayload(payload pptasmessages.PPTASReports) *PptasReportsOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the pptas reports o k response -func (o *PptasReportsOK) SetPayload(payload pptasmessages.PPTASReports) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PptasReportsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(200) - payload := o.Payload - if payload == nil { - // return empty array - payload = pptasmessages.PPTASReports{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// PptasReportsUnauthorizedCode is the HTTP code returned for type PptasReportsUnauthorized -const PptasReportsUnauthorizedCode int = 401 - -/* -PptasReportsUnauthorized The request was denied. - -swagger:response pptasReportsUnauthorized -*/ -type PptasReportsUnauthorized struct { - - /* - In: Body - */ - Payload *pptasmessages.ClientError `json:"body,omitempty"` -} - -// NewPptasReportsUnauthorized creates PptasReportsUnauthorized with default headers values -func NewPptasReportsUnauthorized() *PptasReportsUnauthorized { - - return &PptasReportsUnauthorized{} -} - -// WithPayload adds the payload to the pptas reports unauthorized response -func (o *PptasReportsUnauthorized) WithPayload(payload *pptasmessages.ClientError) *PptasReportsUnauthorized { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the pptas reports unauthorized response -func (o *PptasReportsUnauthorized) SetPayload(payload *pptasmessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PptasReportsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(401) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// PptasReportsForbiddenCode is the HTTP code returned for type PptasReportsForbidden -const PptasReportsForbiddenCode int = 403 - -/* -PptasReportsForbidden The request was denied. - -swagger:response pptasReportsForbidden -*/ -type PptasReportsForbidden struct { - - /* - In: Body - */ - Payload *pptasmessages.ClientError `json:"body,omitempty"` -} - -// NewPptasReportsForbidden creates PptasReportsForbidden with default headers values -func NewPptasReportsForbidden() *PptasReportsForbidden { - - return &PptasReportsForbidden{} -} - -// WithPayload adds the payload to the pptas reports forbidden response -func (o *PptasReportsForbidden) WithPayload(payload *pptasmessages.ClientError) *PptasReportsForbidden { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the pptas reports forbidden response -func (o *PptasReportsForbidden) SetPayload(payload *pptasmessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PptasReportsForbidden) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(403) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - -// PptasReportsInternalServerErrorCode is the HTTP code returned for type PptasReportsInternalServerError -const PptasReportsInternalServerErrorCode int = 500 - -/* -PptasReportsInternalServerError An unexpected error has occurred in the server. - -swagger:response pptasReportsInternalServerError -*/ -type PptasReportsInternalServerError struct { - - /* - In: Body - */ - Payload *pptasmessages.ClientError `json:"body,omitempty"` -} - -// NewPptasReportsInternalServerError creates PptasReportsInternalServerError with default headers values -func NewPptasReportsInternalServerError() *PptasReportsInternalServerError { - - return &PptasReportsInternalServerError{} -} - -// WithPayload adds the payload to the pptas reports internal server error response -func (o *PptasReportsInternalServerError) WithPayload(payload *pptasmessages.ClientError) *PptasReportsInternalServerError { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the pptas reports internal server error response -func (o *PptasReportsInternalServerError) SetPayload(payload *pptasmessages.ClientError) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *PptasReportsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(500) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} diff --git a/pkg/gen/pptasapi/pptasoperations/mymove_api.go b/pkg/gen/pptasapi/pptasoperations/mymove_api.go index c1df613a63c..577f7da53a0 100644 --- a/pkg/gen/pptasapi/pptasoperations/mymove_api.go +++ b/pkg/gen/pptasapi/pptasoperations/mymove_api.go @@ -44,8 +44,8 @@ func NewMymoveAPI(spec *loads.Document) *MymoveAPI { JSONProducer: runtime.JSONProducer(), - MovesPptasReportsHandler: moves.PptasReportsHandlerFunc(func(params moves.PptasReportsParams) middleware.Responder { - return middleware.NotImplemented("operation moves.PptasReports has not yet been implemented") + MovesListMovesHandler: moves.ListMovesHandlerFunc(func(params moves.ListMovesParams) middleware.Responder { + return middleware.NotImplemented("operation moves.ListMoves has not yet been implemented") }), } } @@ -88,8 +88,8 @@ type MymoveAPI struct { // - application/json JSONProducer runtime.Producer - // MovesPptasReportsHandler sets the operation handler for the pptas reports operation - MovesPptasReportsHandler moves.PptasReportsHandler + // MovesListMovesHandler sets the operation handler for the list moves operation + MovesListMovesHandler moves.ListMovesHandler // ServeError is called when an error is received, there is a default handler // but you can set your own with this @@ -167,8 +167,8 @@ func (o *MymoveAPI) Validate() error { unregistered = append(unregistered, "JSONProducer") } - if o.MovesPptasReportsHandler == nil { - unregistered = append(unregistered, "moves.PptasReportsHandler") + if o.MovesListMovesHandler == nil { + unregistered = append(unregistered, "moves.ListMovesHandler") } if len(unregistered) > 0 { @@ -261,7 +261,7 @@ func (o *MymoveAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/moves"] = moves.NewPptasReports(o.context, o.MovesPptasReportsHandler) + o.handlers["GET"]["/moves"] = moves.NewListMoves(o.context, o.MovesListMovesHandler) } // Serve creates a http handler to serve the API over HTTP diff --git a/pkg/gen/pptasclient/moves/list_moves_parameters.go b/pkg/gen/pptasclient/moves/list_moves_parameters.go new file mode 100644 index 00000000000..a0abf41682e --- /dev/null +++ b/pkg/gen/pptasclient/moves/list_moves_parameters.go @@ -0,0 +1,165 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package moves + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListMovesParams creates a new ListMovesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListMovesParams() *ListMovesParams { + return &ListMovesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListMovesParamsWithTimeout creates a new ListMovesParams object +// with the ability to set a timeout on a request. +func NewListMovesParamsWithTimeout(timeout time.Duration) *ListMovesParams { + return &ListMovesParams{ + timeout: timeout, + } +} + +// NewListMovesParamsWithContext creates a new ListMovesParams object +// with the ability to set a context for a request. +func NewListMovesParamsWithContext(ctx context.Context) *ListMovesParams { + return &ListMovesParams{ + Context: ctx, + } +} + +// NewListMovesParamsWithHTTPClient creates a new ListMovesParams object +// with the ability to set a custom HTTPClient for a request. +func NewListMovesParamsWithHTTPClient(client *http.Client) *ListMovesParams { + return &ListMovesParams{ + HTTPClient: client, + } +} + +/* +ListMovesParams contains all the parameters to send to the API endpoint + + for the list moves operation. + + Typically these are written to a http.Request. +*/ +type ListMovesParams struct { + + /* Since. + + Only return moves updated since this time. Formatted like "2021-07-23T18:30:47.116Z" + + Format: date-time + */ + Since *strfmt.DateTime + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list moves params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMovesParams) WithDefaults() *ListMovesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list moves params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListMovesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list moves params +func (o *ListMovesParams) WithTimeout(timeout time.Duration) *ListMovesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list moves params +func (o *ListMovesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list moves params +func (o *ListMovesParams) WithContext(ctx context.Context) *ListMovesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list moves params +func (o *ListMovesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list moves params +func (o *ListMovesParams) WithHTTPClient(client *http.Client) *ListMovesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list moves params +func (o *ListMovesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSince adds the since to the list moves params +func (o *ListMovesParams) WithSince(since *strfmt.DateTime) *ListMovesParams { + o.SetSince(since) + return o +} + +// SetSince adds the since to the list moves params +func (o *ListMovesParams) SetSince(since *strfmt.DateTime) { + o.Since = since +} + +// WriteToRequest writes these params to a swagger request +func (o *ListMovesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Since != nil { + + // query param since + var qrSince strfmt.DateTime + + if o.Since != nil { + qrSince = *o.Since + } + qSince := qrSince.String() + if qSince != "" { + + if err := r.SetQueryParam("since", qSince); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/gen/pptasclient/moves/list_moves_responses.go b/pkg/gen/pptasclient/moves/list_moves_responses.go new file mode 100644 index 00000000000..0d10991f8a9 --- /dev/null +++ b/pkg/gen/pptasclient/moves/list_moves_responses.go @@ -0,0 +1,323 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package moves + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/transcom/mymove/pkg/gen/pptasmessages" +) + +// ListMovesReader is a Reader for the ListMoves structure. +type ListMovesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListMovesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListMovesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewListMovesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListMovesForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListMovesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /moves] listMoves", response, response.Code()) + } +} + +// NewListMovesOK creates a ListMovesOK with default headers values +func NewListMovesOK() *ListMovesOK { + return &ListMovesOK{} +} + +/* +ListMovesOK describes a response with status code 200, with default header values. + +Successfully retrieved moves. A successful fetch might still return zero moves. +*/ +type ListMovesOK struct { + Payload pptasmessages.ListMoves +} + +// IsSuccess returns true when this list moves o k response has a 2xx status code +func (o *ListMovesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list moves o k response has a 3xx status code +func (o *ListMovesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list moves o k response has a 4xx status code +func (o *ListMovesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list moves o k response has a 5xx status code +func (o *ListMovesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list moves o k response a status code equal to that given +func (o *ListMovesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list moves o k response +func (o *ListMovesOK) Code() int { + return 200 +} + +func (o *ListMovesOK) Error() string { + return fmt.Sprintf("[GET /moves][%d] listMovesOK %+v", 200, o.Payload) +} + +func (o *ListMovesOK) String() string { + return fmt.Sprintf("[GET /moves][%d] listMovesOK %+v", 200, o.Payload) +} + +func (o *ListMovesOK) GetPayload() pptasmessages.ListMoves { + return o.Payload +} + +func (o *ListMovesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListMovesUnauthorized creates a ListMovesUnauthorized with default headers values +func NewListMovesUnauthorized() *ListMovesUnauthorized { + return &ListMovesUnauthorized{} +} + +/* +ListMovesUnauthorized describes a response with status code 401, with default header values. + +The request was denied. +*/ +type ListMovesUnauthorized struct { + Payload *pptasmessages.ClientError +} + +// IsSuccess returns true when this list moves unauthorized response has a 2xx status code +func (o *ListMovesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list moves unauthorized response has a 3xx status code +func (o *ListMovesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list moves unauthorized response has a 4xx status code +func (o *ListMovesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list moves unauthorized response has a 5xx status code +func (o *ListMovesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list moves unauthorized response a status code equal to that given +func (o *ListMovesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list moves unauthorized response +func (o *ListMovesUnauthorized) Code() int { + return 401 +} + +func (o *ListMovesUnauthorized) Error() string { + return fmt.Sprintf("[GET /moves][%d] listMovesUnauthorized %+v", 401, o.Payload) +} + +func (o *ListMovesUnauthorized) String() string { + return fmt.Sprintf("[GET /moves][%d] listMovesUnauthorized %+v", 401, o.Payload) +} + +func (o *ListMovesUnauthorized) GetPayload() *pptasmessages.ClientError { + return o.Payload +} + +func (o *ListMovesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(pptasmessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListMovesForbidden creates a ListMovesForbidden with default headers values +func NewListMovesForbidden() *ListMovesForbidden { + return &ListMovesForbidden{} +} + +/* +ListMovesForbidden describes a response with status code 403, with default header values. + +The request was denied. +*/ +type ListMovesForbidden struct { + Payload *pptasmessages.ClientError +} + +// IsSuccess returns true when this list moves forbidden response has a 2xx status code +func (o *ListMovesForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list moves forbidden response has a 3xx status code +func (o *ListMovesForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list moves forbidden response has a 4xx status code +func (o *ListMovesForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list moves forbidden response has a 5xx status code +func (o *ListMovesForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list moves forbidden response a status code equal to that given +func (o *ListMovesForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the list moves forbidden response +func (o *ListMovesForbidden) Code() int { + return 403 +} + +func (o *ListMovesForbidden) Error() string { + return fmt.Sprintf("[GET /moves][%d] listMovesForbidden %+v", 403, o.Payload) +} + +func (o *ListMovesForbidden) String() string { + return fmt.Sprintf("[GET /moves][%d] listMovesForbidden %+v", 403, o.Payload) +} + +func (o *ListMovesForbidden) GetPayload() *pptasmessages.ClientError { + return o.Payload +} + +func (o *ListMovesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(pptasmessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListMovesInternalServerError creates a ListMovesInternalServerError with default headers values +func NewListMovesInternalServerError() *ListMovesInternalServerError { + return &ListMovesInternalServerError{} +} + +/* +ListMovesInternalServerError describes a response with status code 500, with default header values. + +An unexpected error has occurred in the server. +*/ +type ListMovesInternalServerError struct { + Payload *pptasmessages.ClientError +} + +// IsSuccess returns true when this list moves internal server error response has a 2xx status code +func (o *ListMovesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list moves internal server error response has a 3xx status code +func (o *ListMovesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list moves internal server error response has a 4xx status code +func (o *ListMovesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list moves internal server error response has a 5xx status code +func (o *ListMovesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list moves internal server error response a status code equal to that given +func (o *ListMovesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list moves internal server error response +func (o *ListMovesInternalServerError) Code() int { + return 500 +} + +func (o *ListMovesInternalServerError) Error() string { + return fmt.Sprintf("[GET /moves][%d] listMovesInternalServerError %+v", 500, o.Payload) +} + +func (o *ListMovesInternalServerError) String() string { + return fmt.Sprintf("[GET /moves][%d] listMovesInternalServerError %+v", 500, o.Payload) +} + +func (o *ListMovesInternalServerError) GetPayload() *pptasmessages.ClientError { + return o.Payload +} + +func (o *ListMovesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(pptasmessages.ClientError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/gen/pptasclient/moves/moves_client.go b/pkg/gen/pptasclient/moves/moves_client.go index 0417a33f131..767300b1052 100644 --- a/pkg/gen/pptasclient/moves/moves_client.go +++ b/pkg/gen/pptasclient/moves/moves_client.go @@ -30,30 +30,37 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { - PptasReports(params *PptasReportsParams, opts ...ClientOption) (*PptasReportsOK, error) + ListMoves(params *ListMovesParams, opts ...ClientOption) (*ListMovesOK, error) SetTransport(transport runtime.ClientTransport) } /* -PptasReports ps p t a s reports + ListMoves lists moves -Gets all reports that have been approved. Based on payment requests, includes data from Move, Shipments, Orders, and Transportation Accounting Codes and Lines of Accounting. + Gets all moves that have been reviewed and approved by the TOO. The `since` parameter can be used to filter this + +list down to only the moves that have been updated since the provided timestamp. A move will be considered +updated if the `updatedAt` timestamp on the move or on its orders, shipments, service items, or payment +requests, is later than the provided date and time. + +**WIP**: Include what causes moves to leave this list. Currently, once the `availableToPrimeAt` timestamp has +been set, that move will always appear in this list. */ -func (a *Client) PptasReports(params *PptasReportsParams, opts ...ClientOption) (*PptasReportsOK, error) { +func (a *Client) ListMoves(params *ListMovesParams, opts ...ClientOption) (*ListMovesOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewPptasReportsParams() + params = NewListMovesParams() } op := &runtime.ClientOperation{ - ID: "pptasReports", + ID: "listMoves", Method: "GET", PathPattern: "/moves", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &PptasReportsReader{formats: a.formats}, + Reader: &ListMovesReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } @@ -65,13 +72,13 @@ func (a *Client) PptasReports(params *PptasReportsParams, opts ...ClientOption) if err != nil { return nil, err } - success, ok := result.(*PptasReportsOK) + success, ok := result.(*ListMovesOK) if ok { return success, nil } // unexpected success response // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue - msg := fmt.Sprintf("unexpected success response for pptasReports: API contract not enforced by server. Client expected to get an error, but got: %T", result) + msg := fmt.Sprintf("unexpected success response for listMoves: API contract not enforced by server. Client expected to get an error, but got: %T", result) panic(msg) } diff --git a/pkg/gen/pptasclient/moves/pptas_reports_parameters.go b/pkg/gen/pptasclient/moves/pptas_reports_parameters.go deleted file mode 100644 index e739ced55eb..00000000000 --- a/pkg/gen/pptasclient/moves/pptas_reports_parameters.go +++ /dev/null @@ -1,165 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package moves - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewPptasReportsParams creates a new PptasReportsParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewPptasReportsParams() *PptasReportsParams { - return &PptasReportsParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewPptasReportsParamsWithTimeout creates a new PptasReportsParams object -// with the ability to set a timeout on a request. -func NewPptasReportsParamsWithTimeout(timeout time.Duration) *PptasReportsParams { - return &PptasReportsParams{ - timeout: timeout, - } -} - -// NewPptasReportsParamsWithContext creates a new PptasReportsParams object -// with the ability to set a context for a request. -func NewPptasReportsParamsWithContext(ctx context.Context) *PptasReportsParams { - return &PptasReportsParams{ - Context: ctx, - } -} - -// NewPptasReportsParamsWithHTTPClient creates a new PptasReportsParams object -// with the ability to set a custom HTTPClient for a request. -func NewPptasReportsParamsWithHTTPClient(client *http.Client) *PptasReportsParams { - return &PptasReportsParams{ - HTTPClient: client, - } -} - -/* -PptasReportsParams contains all the parameters to send to the API endpoint - - for the pptas reports operation. - - Typically these are written to a http.Request. -*/ -type PptasReportsParams struct { - - /* Since. - - Only return moves updated since this time. Formatted like "2021-07-23T18:30:47.116Z" - - Format: date-time - */ - Since *strfmt.DateTime - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the pptas reports params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PptasReportsParams) WithDefaults() *PptasReportsParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the pptas reports params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *PptasReportsParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the pptas reports params -func (o *PptasReportsParams) WithTimeout(timeout time.Duration) *PptasReportsParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the pptas reports params -func (o *PptasReportsParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the pptas reports params -func (o *PptasReportsParams) WithContext(ctx context.Context) *PptasReportsParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the pptas reports params -func (o *PptasReportsParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the pptas reports params -func (o *PptasReportsParams) WithHTTPClient(client *http.Client) *PptasReportsParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the pptas reports params -func (o *PptasReportsParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithSince adds the since to the pptas reports params -func (o *PptasReportsParams) WithSince(since *strfmt.DateTime) *PptasReportsParams { - o.SetSince(since) - return o -} - -// SetSince adds the since to the pptas reports params -func (o *PptasReportsParams) SetSince(since *strfmt.DateTime) { - o.Since = since -} - -// WriteToRequest writes these params to a swagger request -func (o *PptasReportsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.Since != nil { - - // query param since - var qrSince strfmt.DateTime - - if o.Since != nil { - qrSince = *o.Since - } - qSince := qrSince.String() - if qSince != "" { - - if err := r.SetQueryParam("since", qSince); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/gen/pptasclient/moves/pptas_reports_responses.go b/pkg/gen/pptasclient/moves/pptas_reports_responses.go deleted file mode 100644 index addedc2709c..00000000000 --- a/pkg/gen/pptasclient/moves/pptas_reports_responses.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package moves - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "github.com/transcom/mymove/pkg/gen/pptasmessages" -) - -// PptasReportsReader is a Reader for the PptasReports structure. -type PptasReportsReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *PptasReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewPptasReportsOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewPptasReportsUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 403: - result := NewPptasReportsForbidden() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewPptasReportsInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[GET /moves] pptasReports", response, response.Code()) - } -} - -// NewPptasReportsOK creates a PptasReportsOK with default headers values -func NewPptasReportsOK() *PptasReportsOK { - return &PptasReportsOK{} -} - -/* -PptasReportsOK describes a response with status code 200, with default header values. - -Successfully retrieved pptas reports. A successful fetch might still return zero pptas reports. -*/ -type PptasReportsOK struct { - Payload pptasmessages.PPTASReports -} - -// IsSuccess returns true when this pptas reports o k response has a 2xx status code -func (o *PptasReportsOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this pptas reports o k response has a 3xx status code -func (o *PptasReportsOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this pptas reports o k response has a 4xx status code -func (o *PptasReportsOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this pptas reports o k response has a 5xx status code -func (o *PptasReportsOK) IsServerError() bool { - return false -} - -// IsCode returns true when this pptas reports o k response a status code equal to that given -func (o *PptasReportsOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the pptas reports o k response -func (o *PptasReportsOK) Code() int { - return 200 -} - -func (o *PptasReportsOK) Error() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsOK %+v", 200, o.Payload) -} - -func (o *PptasReportsOK) String() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsOK %+v", 200, o.Payload) -} - -func (o *PptasReportsOK) GetPayload() pptasmessages.PPTASReports { - return o.Payload -} - -func (o *PptasReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPptasReportsUnauthorized creates a PptasReportsUnauthorized with default headers values -func NewPptasReportsUnauthorized() *PptasReportsUnauthorized { - return &PptasReportsUnauthorized{} -} - -/* -PptasReportsUnauthorized describes a response with status code 401, with default header values. - -The request was denied. -*/ -type PptasReportsUnauthorized struct { - Payload *pptasmessages.ClientError -} - -// IsSuccess returns true when this pptas reports unauthorized response has a 2xx status code -func (o *PptasReportsUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this pptas reports unauthorized response has a 3xx status code -func (o *PptasReportsUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this pptas reports unauthorized response has a 4xx status code -func (o *PptasReportsUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this pptas reports unauthorized response has a 5xx status code -func (o *PptasReportsUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this pptas reports unauthorized response a status code equal to that given -func (o *PptasReportsUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the pptas reports unauthorized response -func (o *PptasReportsUnauthorized) Code() int { - return 401 -} - -func (o *PptasReportsUnauthorized) Error() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsUnauthorized %+v", 401, o.Payload) -} - -func (o *PptasReportsUnauthorized) String() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsUnauthorized %+v", 401, o.Payload) -} - -func (o *PptasReportsUnauthorized) GetPayload() *pptasmessages.ClientError { - return o.Payload -} - -func (o *PptasReportsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(pptasmessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPptasReportsForbidden creates a PptasReportsForbidden with default headers values -func NewPptasReportsForbidden() *PptasReportsForbidden { - return &PptasReportsForbidden{} -} - -/* -PptasReportsForbidden describes a response with status code 403, with default header values. - -The request was denied. -*/ -type PptasReportsForbidden struct { - Payload *pptasmessages.ClientError -} - -// IsSuccess returns true when this pptas reports forbidden response has a 2xx status code -func (o *PptasReportsForbidden) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this pptas reports forbidden response has a 3xx status code -func (o *PptasReportsForbidden) IsRedirect() bool { - return false -} - -// IsClientError returns true when this pptas reports forbidden response has a 4xx status code -func (o *PptasReportsForbidden) IsClientError() bool { - return true -} - -// IsServerError returns true when this pptas reports forbidden response has a 5xx status code -func (o *PptasReportsForbidden) IsServerError() bool { - return false -} - -// IsCode returns true when this pptas reports forbidden response a status code equal to that given -func (o *PptasReportsForbidden) IsCode(code int) bool { - return code == 403 -} - -// Code gets the status code for the pptas reports forbidden response -func (o *PptasReportsForbidden) Code() int { - return 403 -} - -func (o *PptasReportsForbidden) Error() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsForbidden %+v", 403, o.Payload) -} - -func (o *PptasReportsForbidden) String() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsForbidden %+v", 403, o.Payload) -} - -func (o *PptasReportsForbidden) GetPayload() *pptasmessages.ClientError { - return o.Payload -} - -func (o *PptasReportsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(pptasmessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewPptasReportsInternalServerError creates a PptasReportsInternalServerError with default headers values -func NewPptasReportsInternalServerError() *PptasReportsInternalServerError { - return &PptasReportsInternalServerError{} -} - -/* -PptasReportsInternalServerError describes a response with status code 500, with default header values. - -An unexpected error has occurred in the server. -*/ -type PptasReportsInternalServerError struct { - Payload *pptasmessages.ClientError -} - -// IsSuccess returns true when this pptas reports internal server error response has a 2xx status code -func (o *PptasReportsInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this pptas reports internal server error response has a 3xx status code -func (o *PptasReportsInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this pptas reports internal server error response has a 4xx status code -func (o *PptasReportsInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this pptas reports internal server error response has a 5xx status code -func (o *PptasReportsInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this pptas reports internal server error response a status code equal to that given -func (o *PptasReportsInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the pptas reports internal server error response -func (o *PptasReportsInternalServerError) Code() int { - return 500 -} - -func (o *PptasReportsInternalServerError) Error() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsInternalServerError %+v", 500, o.Payload) -} - -func (o *PptasReportsInternalServerError) String() string { - return fmt.Sprintf("[GET /moves][%d] pptasReportsInternalServerError %+v", 500, o.Payload) -} - -func (o *PptasReportsInternalServerError) GetPayload() *pptasmessages.ClientError { - return o.Payload -} - -func (o *PptasReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(pptasmessages.ClientError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/pkg/gen/pptasmessages/address.go b/pkg/gen/pptasmessages/address.go deleted file mode 100644 index 3d8abaaeb2d..00000000000 --- a/pkg/gen/pptasmessages/address.go +++ /dev/null @@ -1,372 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// Address A postal address -// -// swagger:model Address -type Address struct { - - // City - // Example: Anytown - // Required: true - City *string `json:"city"` - - // Country - // Example: USA - Country *string `json:"country,omitempty"` - - // County - // Example: LOS ANGELES - County *string `json:"county,omitempty"` - - // e tag - // Read Only: true - ETag string `json:"eTag,omitempty"` - - // id - // Example: c56a4180-65aa-42ec-a945-5fd21dec0538 - // Format: uuid - ID strfmt.UUID `json:"id,omitempty"` - - // ZIP - // Example: 90210 - // Required: true - // Pattern: ^(\d{5}([\-]\d{4})?)$ - PostalCode *string `json:"postalCode"` - - // State - // Required: true - // Enum: [AL AK AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY] - State *string `json:"state"` - - // Street address 1 - // Example: 123 Main Ave - // Required: true - StreetAddress1 *string `json:"streetAddress1"` - - // Street address 2 - // Example: Apartment 9000 - StreetAddress2 *string `json:"streetAddress2,omitempty"` - - // Address Line 3 - // Example: Montmârtre - StreetAddress3 *string `json:"streetAddress3,omitempty"` -} - -// Validate validates this address -func (m *Address) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCity(formats); err != nil { - res = append(res, err) - } - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePostalCode(formats); err != nil { - res = append(res, err) - } - - if err := m.validateState(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStreetAddress1(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Address) validateCity(formats strfmt.Registry) error { - - if err := validate.Required("city", "body", m.City); err != nil { - return err - } - - return nil -} - -func (m *Address) validateID(formats strfmt.Registry) error { - if swag.IsZero(m.ID) { // not required - return nil - } - - if err := validate.FormatOf("id", "body", "uuid", m.ID.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *Address) validatePostalCode(formats strfmt.Registry) error { - - if err := validate.Required("postalCode", "body", m.PostalCode); err != nil { - return err - } - - if err := validate.Pattern("postalCode", "body", *m.PostalCode, `^(\d{5}([\-]\d{4})?)$`); err != nil { - return err - } - - return nil -} - -var addressTypeStatePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["AL","AK","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - addressTypeStatePropEnum = append(addressTypeStatePropEnum, v) - } -} - -const ( - - // AddressStateAL captures enum value "AL" - AddressStateAL string = "AL" - - // AddressStateAK captures enum value "AK" - AddressStateAK string = "AK" - - // AddressStateAR captures enum value "AR" - AddressStateAR string = "AR" - - // AddressStateAZ captures enum value "AZ" - AddressStateAZ string = "AZ" - - // AddressStateCA captures enum value "CA" - AddressStateCA string = "CA" - - // AddressStateCO captures enum value "CO" - AddressStateCO string = "CO" - - // AddressStateCT captures enum value "CT" - AddressStateCT string = "CT" - - // AddressStateDC captures enum value "DC" - AddressStateDC string = "DC" - - // AddressStateDE captures enum value "DE" - AddressStateDE string = "DE" - - // AddressStateFL captures enum value "FL" - AddressStateFL string = "FL" - - // AddressStateGA captures enum value "GA" - AddressStateGA string = "GA" - - // AddressStateHI captures enum value "HI" - AddressStateHI string = "HI" - - // AddressStateIA captures enum value "IA" - AddressStateIA string = "IA" - - // AddressStateID captures enum value "ID" - AddressStateID string = "ID" - - // AddressStateIL captures enum value "IL" - AddressStateIL string = "IL" - - // AddressStateIN captures enum value "IN" - AddressStateIN string = "IN" - - // AddressStateKS captures enum value "KS" - AddressStateKS string = "KS" - - // AddressStateKY captures enum value "KY" - AddressStateKY string = "KY" - - // AddressStateLA captures enum value "LA" - AddressStateLA string = "LA" - - // AddressStateMA captures enum value "MA" - AddressStateMA string = "MA" - - // AddressStateMD captures enum value "MD" - AddressStateMD string = "MD" - - // AddressStateME captures enum value "ME" - AddressStateME string = "ME" - - // AddressStateMI captures enum value "MI" - AddressStateMI string = "MI" - - // AddressStateMN captures enum value "MN" - AddressStateMN string = "MN" - - // AddressStateMO captures enum value "MO" - AddressStateMO string = "MO" - - // AddressStateMS captures enum value "MS" - AddressStateMS string = "MS" - - // AddressStateMT captures enum value "MT" - AddressStateMT string = "MT" - - // AddressStateNC captures enum value "NC" - AddressStateNC string = "NC" - - // AddressStateND captures enum value "ND" - AddressStateND string = "ND" - - // AddressStateNE captures enum value "NE" - AddressStateNE string = "NE" - - // AddressStateNH captures enum value "NH" - AddressStateNH string = "NH" - - // AddressStateNJ captures enum value "NJ" - AddressStateNJ string = "NJ" - - // AddressStateNM captures enum value "NM" - AddressStateNM string = "NM" - - // AddressStateNV captures enum value "NV" - AddressStateNV string = "NV" - - // AddressStateNY captures enum value "NY" - AddressStateNY string = "NY" - - // AddressStateOH captures enum value "OH" - AddressStateOH string = "OH" - - // AddressStateOK captures enum value "OK" - AddressStateOK string = "OK" - - // AddressStateOR captures enum value "OR" - AddressStateOR string = "OR" - - // AddressStatePA captures enum value "PA" - AddressStatePA string = "PA" - - // AddressStateRI captures enum value "RI" - AddressStateRI string = "RI" - - // AddressStateSC captures enum value "SC" - AddressStateSC string = "SC" - - // AddressStateSD captures enum value "SD" - AddressStateSD string = "SD" - - // AddressStateTN captures enum value "TN" - AddressStateTN string = "TN" - - // AddressStateTX captures enum value "TX" - AddressStateTX string = "TX" - - // AddressStateUT captures enum value "UT" - AddressStateUT string = "UT" - - // AddressStateVA captures enum value "VA" - AddressStateVA string = "VA" - - // AddressStateVT captures enum value "VT" - AddressStateVT string = "VT" - - // AddressStateWA captures enum value "WA" - AddressStateWA string = "WA" - - // AddressStateWI captures enum value "WI" - AddressStateWI string = "WI" - - // AddressStateWV captures enum value "WV" - AddressStateWV string = "WV" - - // AddressStateWY captures enum value "WY" - AddressStateWY string = "WY" -) - -// prop value enum -func (m *Address) validateStateEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, addressTypeStatePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *Address) validateState(formats strfmt.Registry) error { - - if err := validate.Required("state", "body", m.State); err != nil { - return err - } - - // value enum - if err := m.validateStateEnum("state", "body", *m.State); err != nil { - return err - } - - return nil -} - -func (m *Address) validateStreetAddress1(formats strfmt.Registry) error { - - if err := validate.Required("streetAddress1", "body", m.StreetAddress1); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this address based on the context it is used -func (m *Address) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateETag(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Address) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { - - if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag)); err != nil { - return err - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Address) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Address) UnmarshalBinary(b []byte) error { - var res Address - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/gen/pptasmessages/affiliation.go b/pkg/gen/pptasmessages/affiliation.go deleted file mode 100644 index 18ce1d01861..00000000000 --- a/pkg/gen/pptasmessages/affiliation.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// Affiliation Branch of service -// -// # Military branch of service -// -// swagger:model Affiliation -type Affiliation string - -func NewAffiliation(value Affiliation) *Affiliation { - return &value -} - -// Pointer returns a pointer to a freshly-allocated Affiliation. -func (m Affiliation) Pointer() *Affiliation { - return &m -} - -const ( - - // AffiliationARMY captures enum value "ARMY" - AffiliationARMY Affiliation = "ARMY" - - // AffiliationNAVY captures enum value "NAVY" - AffiliationNAVY Affiliation = "NAVY" - - // AffiliationMARINES captures enum value "MARINES" - AffiliationMARINES Affiliation = "MARINES" - - // AffiliationAIRFORCE captures enum value "AIR_FORCE" - AffiliationAIRFORCE Affiliation = "AIR_FORCE" - - // AffiliationCOASTGUARD captures enum value "COAST_GUARD" - AffiliationCOASTGUARD Affiliation = "COAST_GUARD" - - // AffiliationSPACEFORCE captures enum value "SPACE_FORCE" - AffiliationSPACEFORCE Affiliation = "SPACE_FORCE" - - // AffiliationNAVYANDMARINES captures enum value "NAVY_AND_MARINES" - AffiliationNAVYANDMARINES Affiliation = "NAVY_AND_MARINES" - - // AffiliationAIRANDSPACEFORCE captures enum value "AIR_AND_SPACE_FORCE" - AffiliationAIRANDSPACEFORCE Affiliation = "AIR_AND_SPACE_FORCE" - - // AffiliationOTHER captures enum value "OTHER" - AffiliationOTHER Affiliation = "OTHER" -) - -// for schema -var affiliationEnum []interface{} - -func init() { - var res []Affiliation - if err := json.Unmarshal([]byte(`["ARMY","NAVY","MARINES","AIR_FORCE","COAST_GUARD","SPACE_FORCE","NAVY_AND_MARINES","AIR_AND_SPACE_FORCE","OTHER"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - affiliationEnum = append(affiliationEnum, v) - } -} - -func (m Affiliation) validateAffiliationEnum(path, location string, value Affiliation) error { - if err := validate.EnumCase(path, location, value, affiliationEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this affiliation -func (m Affiliation) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateAffiliationEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this affiliation based on context it is used -func (m Affiliation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/pkg/gen/pptasmessages/crate.go b/pkg/gen/pptasmessages/crate.go deleted file mode 100644 index 487a8b4ba7b..00000000000 --- a/pkg/gen/pptasmessages/crate.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// Crate Crate object for PPTAS Reports -// -// swagger:model Crate -type Crate struct { - - // crate dimensions - CrateDimensions *MTOServiceItemDimension `json:"crateDimensions,omitempty"` - - // description - Description string `json:"description,omitempty"` - - // item dimensions - ItemDimensions *MTOServiceItemDimension `json:"itemDimensions,omitempty"` -} - -// Validate validates this crate -func (m *Crate) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCrateDimensions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateItemDimensions(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Crate) validateCrateDimensions(formats strfmt.Registry) error { - if swag.IsZero(m.CrateDimensions) { // not required - return nil - } - - if m.CrateDimensions != nil { - if err := m.CrateDimensions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("crateDimensions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("crateDimensions") - } - return err - } - } - - return nil -} - -func (m *Crate) validateItemDimensions(formats strfmt.Registry) error { - if swag.IsZero(m.ItemDimensions) { // not required - return nil - } - - if m.ItemDimensions != nil { - if err := m.ItemDimensions.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("itemDimensions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("itemDimensions") - } - return err - } - } - - return nil -} - -// ContextValidate validate this crate based on the context it is used -func (m *Crate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCrateDimensions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateItemDimensions(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Crate) contextValidateCrateDimensions(ctx context.Context, formats strfmt.Registry) error { - - if m.CrateDimensions != nil { - - if swag.IsZero(m.CrateDimensions) { // not required - return nil - } - - if err := m.CrateDimensions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("crateDimensions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("crateDimensions") - } - return err - } - } - - return nil -} - -func (m *Crate) contextValidateItemDimensions(ctx context.Context, formats strfmt.Registry) error { - - if m.ItemDimensions != nil { - - if swag.IsZero(m.ItemDimensions) { // not required - return nil - } - - if err := m.ItemDimensions.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("itemDimensions") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("itemDimensions") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *Crate) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *Crate) UnmarshalBinary(b []byte) error { - var res Crate - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/gen/pptasmessages/dimension_type.go b/pkg/gen/pptasmessages/dimension_type.go deleted file mode 100644 index f2ee65bbff6..00000000000 --- a/pkg/gen/pptasmessages/dimension_type.go +++ /dev/null @@ -1,78 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// DimensionType Describes a dimension type for a MTOServiceItemDimension. -// -// swagger:model DimensionType -type DimensionType string - -func NewDimensionType(value DimensionType) *DimensionType { - return &value -} - -// Pointer returns a pointer to a freshly-allocated DimensionType. -func (m DimensionType) Pointer() *DimensionType { - return &m -} - -const ( - - // DimensionTypeITEM captures enum value "ITEM" - DimensionTypeITEM DimensionType = "ITEM" - - // DimensionTypeCRATE captures enum value "CRATE" - DimensionTypeCRATE DimensionType = "CRATE" -) - -// for schema -var dimensionTypeEnum []interface{} - -func init() { - var res []DimensionType - if err := json.Unmarshal([]byte(`["ITEM","CRATE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - dimensionTypeEnum = append(dimensionTypeEnum, v) - } -} - -func (m DimensionType) validateDimensionTypeEnum(path, location string, value DimensionType) error { - if err := validate.EnumCase(path, location, value, dimensionTypeEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this dimension type -func (m DimensionType) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateDimensionTypeEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this dimension type based on context it is used -func (m DimensionType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/pkg/gen/pptasmessages/list_move.go b/pkg/gen/pptasmessages/list_move.go new file mode 100644 index 00000000000..ff5abe85c25 --- /dev/null +++ b/pkg/gen/pptasmessages/list_move.go @@ -0,0 +1,293 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package pptasmessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ListMove An abbreviated definition for a move, without all the nested information (shipments, service items, etc). Used to fetch a list of moves more efficiently. +// +// swagger:model ListMove +type ListMove struct { + + // available to prime at + // Read Only: true + // Format: date-time + AvailableToPrimeAt *strfmt.DateTime `json:"availableToPrimeAt,omitempty"` + + // created at + // Read Only: true + // Format: date-time + CreatedAt strfmt.DateTime `json:"createdAt,omitempty"` + + // e tag + // Read Only: true + ETag string `json:"eTag,omitempty"` + + // id + // Example: 1f2270c7-7166-40ae-981e-b200ebdf3054 + // Format: uuid + ID strfmt.UUID `json:"id,omitempty"` + + // move code + // Example: HYXFJF + // Read Only: true + MoveCode string `json:"moveCode,omitempty"` + + // order ID + // Example: c56a4180-65aa-42ec-a945-5fd21dec0538 + // Format: uuid + OrderID strfmt.UUID `json:"orderID,omitempty"` + + // ppm type + // Enum: [FULL PARTIAL] + PpmType string `json:"ppmType,omitempty"` + + // reference Id + // Example: 1001-3456 + ReferenceID string `json:"referenceId,omitempty"` + + // updated at + // Read Only: true + // Format: date-time + UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"` +} + +// Validate validates this list move +func (m *ListMove) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAvailableToPrimeAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePpmType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedAt(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListMove) validateAvailableToPrimeAt(formats strfmt.Registry) error { + if swag.IsZero(m.AvailableToPrimeAt) { // not required + return nil + } + + if err := validate.FormatOf("availableToPrimeAt", "body", "date-time", m.AvailableToPrimeAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ListMove) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ListMove) validateID(formats strfmt.Registry) error { + if swag.IsZero(m.ID) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ListMove) validateOrderID(formats strfmt.Registry) error { + if swag.IsZero(m.OrderID) { // not required + return nil + } + + if err := validate.FormatOf("orderID", "body", "uuid", m.OrderID.String(), formats); err != nil { + return err + } + + return nil +} + +var listMoveTypePpmTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["FULL","PARTIAL"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + listMoveTypePpmTypePropEnum = append(listMoveTypePpmTypePropEnum, v) + } +} + +const ( + + // ListMovePpmTypeFULL captures enum value "FULL" + ListMovePpmTypeFULL string = "FULL" + + // ListMovePpmTypePARTIAL captures enum value "PARTIAL" + ListMovePpmTypePARTIAL string = "PARTIAL" +) + +// prop value enum +func (m *ListMove) validatePpmTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, listMoveTypePpmTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ListMove) validatePpmType(formats strfmt.Registry) error { + if swag.IsZero(m.PpmType) { // not required + return nil + } + + // value enum + if err := m.validatePpmTypeEnum("ppmType", "body", m.PpmType); err != nil { + return err + } + + return nil +} + +func (m *ListMove) validateUpdatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedAt) { // not required + return nil + } + + if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this list move based on the context it is used +func (m *ListMove) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAvailableToPrimeAt(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreatedAt(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMoveCode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdatedAt(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListMove) contextValidateAvailableToPrimeAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "availableToPrimeAt", "body", m.AvailableToPrimeAt); err != nil { + return err + } + + return nil +} + +func (m *ListMove) contextValidateCreatedAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "createdAt", "body", strfmt.DateTime(m.CreatedAt)); err != nil { + return err + } + + return nil +} + +func (m *ListMove) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag)); err != nil { + return err + } + + return nil +} + +func (m *ListMove) contextValidateMoveCode(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "moveCode", "body", string(m.MoveCode)); err != nil { + return err + } + + return nil +} + +func (m *ListMove) contextValidateUpdatedAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "updatedAt", "body", strfmt.DateTime(m.UpdatedAt)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListMove) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListMove) UnmarshalBinary(b []byte) error { + var res ListMove + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/pptasmessages/p_p_t_a_s_reports.go b/pkg/gen/pptasmessages/list_moves.go similarity index 77% rename from pkg/gen/pptasmessages/p_p_t_a_s_reports.go rename to pkg/gen/pptasmessages/list_moves.go index b39b4133f5c..5ac76fbe8c7 100644 --- a/pkg/gen/pptasmessages/p_p_t_a_s_reports.go +++ b/pkg/gen/pptasmessages/list_moves.go @@ -14,13 +14,13 @@ import ( "github.com/go-openapi/swag" ) -// PPTASReports p p t a s reports +// ListMoves list moves // -// swagger:model PPTASReports -type PPTASReports []*PPTASReport +// swagger:model ListMoves +type ListMoves []*ListMove -// Validate validates this p p t a s reports -func (m PPTASReports) Validate(formats strfmt.Registry) error { +// Validate validates this list moves +func (m ListMoves) Validate(formats strfmt.Registry) error { var res []error for i := 0; i < len(m); i++ { @@ -47,8 +47,8 @@ func (m PPTASReports) Validate(formats strfmt.Registry) error { return nil } -// ContextValidate validate this p p t a s reports based on the context it is used -func (m PPTASReports) ContextValidate(ctx context.Context, formats strfmt.Registry) error { +// ContextValidate validate this list moves based on the context it is used +func (m ListMoves) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error for i := 0; i < len(m); i++ { diff --git a/pkg/gen/pptasmessages/m_t_o_service_item_dimension.go b/pkg/gen/pptasmessages/m_t_o_service_item_dimension.go deleted file mode 100644 index f7c69451292..00000000000 --- a/pkg/gen/pptasmessages/m_t_o_service_item_dimension.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// MTOServiceItemDimension Describes a dimension object for the MTOServiceItem. -// -// swagger:model MTOServiceItemDimension -type MTOServiceItemDimension struct { - - // Height in thousandth inches. 1000 thou = 1 inch. - // Example: 1000 - Height int32 `json:"height,omitempty"` - - // id - // Example: 1f2270c7-7166-40ae-981e-b200ebdf3054 - // Format: uuid - ID strfmt.UUID `json:"id,omitempty"` - - // Length in thousandth inches. 1000 thou = 1 inch. - // Example: 1000 - Length int32 `json:"length,omitempty"` - - // type - Type DimensionType `json:"type,omitempty"` - - // Width in thousandth inches. 1000 thou = 1 inch. - // Example: 1000 - Width int32 `json:"width,omitempty"` -} - -// Validate validates this m t o service item dimension -func (m *MTOServiceItemDimension) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateType(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *MTOServiceItemDimension) validateID(formats strfmt.Registry) error { - if swag.IsZero(m.ID) { // not required - return nil - } - - if err := validate.FormatOf("id", "body", "uuid", m.ID.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *MTOServiceItemDimension) validateType(formats strfmt.Registry) error { - if swag.IsZero(m.Type) { // not required - return nil - } - - if err := m.Type.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("type") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("type") - } - return err - } - - return nil -} - -// ContextValidate validate this m t o service item dimension based on the context it is used -func (m *MTOServiceItemDimension) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateType(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *MTOServiceItemDimension) contextValidateType(ctx context.Context, formats strfmt.Registry) error { - - if swag.IsZero(m.Type) { // not required - return nil - } - - if err := m.Type.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("type") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("type") - } - return err - } - - return nil -} - -// MarshalBinary interface implementation -func (m *MTOServiceItemDimension) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *MTOServiceItemDimension) UnmarshalBinary(b []byte) error { - var res MTOServiceItemDimension - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/gen/pptasmessages/p_p_t_a_s_report.go b/pkg/gen/pptasmessages/p_p_t_a_s_report.go deleted file mode 100644 index d36335b5882..00000000000 --- a/pkg/gen/pptasmessages/p_p_t_a_s_report.go +++ /dev/null @@ -1,510 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PPTASReport Report for Navy PPTAS, contains information about Service Members, Orders, Move Task Orders, Shipments, and Payment Requests. -// -// swagger:model PPTASReport -type PPTASReport struct { - - // address - Address *Address `json:"address,omitempty"` - - // affiliation - Affiliation *Affiliation `json:"affiliation,omitempty"` - - // counseled date - // Format: date - CounseledDate strfmt.Date `json:"counseledDate,omitempty"` - - // Dependent Code - DepCD *bool `json:"depCD,omitempty"` - - // destination gbloc - // Pattern: ^[A-Z]{4}$ - DestinationGbloc *string `json:"destinationGbloc,omitempty"` - - // edipi - Edipi string `json:"edipi,omitempty"` - - // email primary - // Example: a@b.com - EmailPrimary string `json:"emailPrimary,omitempty"` - - // email secondary - EmailSecondary *string `json:"emailSecondary,omitempty"` - - // entitlement weight - EntitlementWeight *int64 `json:"entitlementWeight,omitempty"` - - // financial review flag - FinancialReviewFlag *bool `json:"financialReviewFlag,omitempty"` - - // financial review remarks - FinancialReviewRemarks *string `json:"financialReviewRemarks,omitempty"` - - // first name - // Example: Bob - FirstName string `json:"firstName,omitempty"` - - // last name - // Example: Job - LastName string `json:"lastName,omitempty"` - - // middle initial - // Example: G - MiddleInitial *string `json:"middleInitial,omitempty"` - - // not to be confused with Orders Number - // Example: 030-00362 - OrderNumber *string `json:"orderNumber,omitempty"` - - // orders date - // Format: date-time - OrdersDate strfmt.DateTime `json:"ordersDate,omitempty"` - - // orders number - OrdersNumber string `json:"ordersNumber,omitempty"` - - // orders type - OrdersType string `json:"ordersType,omitempty"` - - // origin gbloc - // Pattern: ^[A-Z]{4}$ - OriginGbloc *string `json:"originGbloc,omitempty"` - - // grade - // Enum: [E_1 E_2 E_3 E_4 E_5 E_6 E_7 E_8 E_9 E_9_SPECIAL_SENIOR_ENLISTED O_1_ACADEMY_GRADUATE O_2 O_3 O_4 O_5 O_6 O_7 O_8 O_9 O_10 W_1 W_2 W_3 W_4 W_5 AVIATION_CADET CIVILIAN_EMPLOYEE ACADEMY_CADET MIDSHIPMAN] - PayGrade *string `json:"payGrade,omitempty"` - - // phone primary - PhonePrimary string `json:"phonePrimary,omitempty"` - - // phone secondary - PhoneSecondary *string `json:"phoneSecondary,omitempty"` - - // scac - // Example: AGFM - Scac *string `json:"scac,omitempty"` - - // Number of shipments - ShipmentNum int64 `json:"shipmentNum,omitempty"` - - // shipments - Shipments []*PPTASShipment `json:"shipments"` - - // Transportation Accounting Code - Tac *string `json:"tac,omitempty"` - - // Transmit Code - TransmitCD *string `json:"transmitCD,omitempty"` - - // travel class code - // Example: PCS - TravelClassCode string `json:"travelClassCode,omitempty"` - - // Travel Type - // Example: Shipment of HHG Permitted - TravelType string `json:"travelType,omitempty"` - - // weight authorized - WeightAuthorized *float64 `json:"weightAuthorized,omitempty"` -} - -// Validate validates this p p t a s report -func (m *PPTASReport) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAddress(formats); err != nil { - res = append(res, err) - } - - if err := m.validateAffiliation(formats); err != nil { - res = append(res, err) - } - - if err := m.validateCounseledDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDestinationGbloc(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOrdersDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOriginGbloc(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePayGrade(formats); err != nil { - res = append(res, err) - } - - if err := m.validateShipments(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PPTASReport) validateAddress(formats strfmt.Registry) error { - if swag.IsZero(m.Address) { // not required - return nil - } - - if m.Address != nil { - if err := m.Address.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("address") - } - return err - } - } - - return nil -} - -func (m *PPTASReport) validateAffiliation(formats strfmt.Registry) error { - if swag.IsZero(m.Affiliation) { // not required - return nil - } - - if m.Affiliation != nil { - if err := m.Affiliation.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("affiliation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("affiliation") - } - return err - } - } - - return nil -} - -func (m *PPTASReport) validateCounseledDate(formats strfmt.Registry) error { - if swag.IsZero(m.CounseledDate) { // not required - return nil - } - - if err := validate.FormatOf("counseledDate", "body", "date", m.CounseledDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASReport) validateDestinationGbloc(formats strfmt.Registry) error { - if swag.IsZero(m.DestinationGbloc) { // not required - return nil - } - - if err := validate.Pattern("destinationGbloc", "body", *m.DestinationGbloc, `^[A-Z]{4}$`); err != nil { - return err - } - - return nil -} - -func (m *PPTASReport) validateOrdersDate(formats strfmt.Registry) error { - if swag.IsZero(m.OrdersDate) { // not required - return nil - } - - if err := validate.FormatOf("ordersDate", "body", "date-time", m.OrdersDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASReport) validateOriginGbloc(formats strfmt.Registry) error { - if swag.IsZero(m.OriginGbloc) { // not required - return nil - } - - if err := validate.Pattern("originGbloc", "body", *m.OriginGbloc, `^[A-Z]{4}$`); err != nil { - return err - } - - return nil -} - -var pPTASReportTypePayGradePropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["E_1","E_2","E_3","E_4","E_5","E_6","E_7","E_8","E_9","E_9_SPECIAL_SENIOR_ENLISTED","O_1_ACADEMY_GRADUATE","O_2","O_3","O_4","O_5","O_6","O_7","O_8","O_9","O_10","W_1","W_2","W_3","W_4","W_5","AVIATION_CADET","CIVILIAN_EMPLOYEE","ACADEMY_CADET","MIDSHIPMAN"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - pPTASReportTypePayGradePropEnum = append(pPTASReportTypePayGradePropEnum, v) - } -} - -const ( - - // PPTASReportPayGradeE1 captures enum value "E_1" - PPTASReportPayGradeE1 string = "E_1" - - // PPTASReportPayGradeE2 captures enum value "E_2" - PPTASReportPayGradeE2 string = "E_2" - - // PPTASReportPayGradeE3 captures enum value "E_3" - PPTASReportPayGradeE3 string = "E_3" - - // PPTASReportPayGradeE4 captures enum value "E_4" - PPTASReportPayGradeE4 string = "E_4" - - // PPTASReportPayGradeE5 captures enum value "E_5" - PPTASReportPayGradeE5 string = "E_5" - - // PPTASReportPayGradeE6 captures enum value "E_6" - PPTASReportPayGradeE6 string = "E_6" - - // PPTASReportPayGradeE7 captures enum value "E_7" - PPTASReportPayGradeE7 string = "E_7" - - // PPTASReportPayGradeE8 captures enum value "E_8" - PPTASReportPayGradeE8 string = "E_8" - - // PPTASReportPayGradeE9 captures enum value "E_9" - PPTASReportPayGradeE9 string = "E_9" - - // PPTASReportPayGradeE9SPECIALSENIORENLISTED captures enum value "E_9_SPECIAL_SENIOR_ENLISTED" - PPTASReportPayGradeE9SPECIALSENIORENLISTED string = "E_9_SPECIAL_SENIOR_ENLISTED" - - // PPTASReportPayGradeO1ACADEMYGRADUATE captures enum value "O_1_ACADEMY_GRADUATE" - PPTASReportPayGradeO1ACADEMYGRADUATE string = "O_1_ACADEMY_GRADUATE" - - // PPTASReportPayGradeO2 captures enum value "O_2" - PPTASReportPayGradeO2 string = "O_2" - - // PPTASReportPayGradeO3 captures enum value "O_3" - PPTASReportPayGradeO3 string = "O_3" - - // PPTASReportPayGradeO4 captures enum value "O_4" - PPTASReportPayGradeO4 string = "O_4" - - // PPTASReportPayGradeO5 captures enum value "O_5" - PPTASReportPayGradeO5 string = "O_5" - - // PPTASReportPayGradeO6 captures enum value "O_6" - PPTASReportPayGradeO6 string = "O_6" - - // PPTASReportPayGradeO7 captures enum value "O_7" - PPTASReportPayGradeO7 string = "O_7" - - // PPTASReportPayGradeO8 captures enum value "O_8" - PPTASReportPayGradeO8 string = "O_8" - - // PPTASReportPayGradeO9 captures enum value "O_9" - PPTASReportPayGradeO9 string = "O_9" - - // PPTASReportPayGradeO10 captures enum value "O_10" - PPTASReportPayGradeO10 string = "O_10" - - // PPTASReportPayGradeW1 captures enum value "W_1" - PPTASReportPayGradeW1 string = "W_1" - - // PPTASReportPayGradeW2 captures enum value "W_2" - PPTASReportPayGradeW2 string = "W_2" - - // PPTASReportPayGradeW3 captures enum value "W_3" - PPTASReportPayGradeW3 string = "W_3" - - // PPTASReportPayGradeW4 captures enum value "W_4" - PPTASReportPayGradeW4 string = "W_4" - - // PPTASReportPayGradeW5 captures enum value "W_5" - PPTASReportPayGradeW5 string = "W_5" - - // PPTASReportPayGradeAVIATIONCADET captures enum value "AVIATION_CADET" - PPTASReportPayGradeAVIATIONCADET string = "AVIATION_CADET" - - // PPTASReportPayGradeCIVILIANEMPLOYEE captures enum value "CIVILIAN_EMPLOYEE" - PPTASReportPayGradeCIVILIANEMPLOYEE string = "CIVILIAN_EMPLOYEE" - - // PPTASReportPayGradeACADEMYCADET captures enum value "ACADEMY_CADET" - PPTASReportPayGradeACADEMYCADET string = "ACADEMY_CADET" - - // PPTASReportPayGradeMIDSHIPMAN captures enum value "MIDSHIPMAN" - PPTASReportPayGradeMIDSHIPMAN string = "MIDSHIPMAN" -) - -// prop value enum -func (m *PPTASReport) validatePayGradeEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, pPTASReportTypePayGradePropEnum, true); err != nil { - return err - } - return nil -} - -func (m *PPTASReport) validatePayGrade(formats strfmt.Registry) error { - if swag.IsZero(m.PayGrade) { // not required - return nil - } - - // value enum - if err := m.validatePayGradeEnum("payGrade", "body", *m.PayGrade); err != nil { - return err - } - - return nil -} - -func (m *PPTASReport) validateShipments(formats strfmt.Registry) error { - if swag.IsZero(m.Shipments) { // not required - return nil - } - - for i := 0; i < len(m.Shipments); i++ { - if swag.IsZero(m.Shipments[i]) { // not required - continue - } - - if m.Shipments[i] != nil { - if err := m.Shipments[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("shipments" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("shipments" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this p p t a s report based on the context it is used -func (m *PPTASReport) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAddress(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateAffiliation(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateShipments(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PPTASReport) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error { - - if m.Address != nil { - - if swag.IsZero(m.Address) { // not required - return nil - } - - if err := m.Address.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("address") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("address") - } - return err - } - } - - return nil -} - -func (m *PPTASReport) contextValidateAffiliation(ctx context.Context, formats strfmt.Registry) error { - - if m.Affiliation != nil { - - if swag.IsZero(m.Affiliation) { // not required - return nil - } - - if err := m.Affiliation.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("affiliation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("affiliation") - } - return err - } - } - - return nil -} - -func (m *PPTASReport) contextValidateShipments(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Shipments); i++ { - - if m.Shipments[i] != nil { - - if swag.IsZero(m.Shipments[i]) { // not required - return nil - } - - if err := m.Shipments[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("shipments" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("shipments" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PPTASReport) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PPTASReport) UnmarshalBinary(b []byte) error { - var res PPTASReport - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/gen/pptasmessages/p_p_t_a_s_shipment.go b/pkg/gen/pptasmessages/p_p_t_a_s_shipment.go deleted file mode 100644 index c59cfc5eb70..00000000000 --- a/pkg/gen/pptasmessages/p_p_t_a_s_shipment.go +++ /dev/null @@ -1,532 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package pptasmessages - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// PPTASShipment Shipment definition used for PPTAS reports. -// -// swagger:model PPTASShipment -type PPTASShipment struct { - - // LoaTrnsnID in lines_of_accounting - Aaa *string `json:"aaa,omitempty"` - - // actual origin net weight - ActualOriginNetWeight *float64 `json:"actualOriginNetWeight,omitempty"` - - // Appropriation - Appro *string `json:"appro,omitempty"` - - // LoaSbaltmtRcpntID in lines_of_accounting - Bcn *string `json:"bcn,omitempty"` - - // LoaPgmElmntID in lines_of_accounting - CostCD *string `json:"costCD,omitempty"` - - // counseling fee total - CounselingFeeTotal *float64 `json:"counselingFeeTotal,omitempty"` - - // crating dimensions - CratingDimensions []*Crate `json:"cratingDimensions"` - - // crating total - CratingTotal *float64 `json:"cratingTotal,omitempty"` - - // Counseling Date - // Format: date - Dd2278IssueDate strfmt.Date `json:"dd2278IssueDate,omitempty"` - - // LoaDptID in lines_of_accounting - Ddcd *string `json:"ddcd,omitempty"` - - // delivery date - // Format: date - DeliveryDate strfmt.Date `json:"deliveryDate,omitempty"` - - // destination address - DestinationAddress *Address `json:"destinationAddress,omitempty"` - - // destination price - DestinationPrice *float64 `json:"destinationPrice,omitempty"` - - // destination reweigh net weight - DestinationReweighNetWeight *float64 `json:"destinationReweighNetWeight,omitempty"` - - // fiscal year - FiscalYear *string `json:"fiscalYear,omitempty"` - - // Invoice Paid Amounts - InvoicePaidAmt *float64 `json:"invoicePaidAmt,omitempty"` - - // linehaul fuel total - LinehaulFuelTotal *float64 `json:"linehaulFuelTotal,omitempty"` - - // linehaul total - LinehaulTotal *float64 `json:"linehaulTotal,omitempty"` - - // Line of Accounting - Loa *string `json:"loa,omitempty"` - - // miles - Miles int64 `json:"miles,omitempty"` - - // move date - // Format: date - MoveDate *strfmt.Date `json:"moveDate,omitempty"` - - // move management fee total - MoveManagementFeeTotal *float64 `json:"moveManagementFeeTotal,omitempty"` - - // net weight - NetWeight *int64 `json:"netWeight,omitempty"` - - // LoaAlltSnID in lines_of_accounting - ObjClass *string `json:"objClass,omitempty"` - - // origin address - OriginAddress *Address `json:"originAddress,omitempty"` - - // origin price - OriginPrice *float64 `json:"originPrice,omitempty"` - - // LoaDocID in lines_of_accounting - Paa *string `json:"paa,omitempty"` - - // packing price - PackingPrice *float64 `json:"packingPrice,omitempty"` - - // paid date - // Format: date - PaidDate *strfmt.Date `json:"paidDate,omitempty"` - - // Pro Gear - PbpAnde *float64 `json:"pbpAnde,omitempty"` - - // pickup date - // Format: date - PickupDate strfmt.Date `json:"pickupDate,omitempty"` - - // ppm dest price - PpmDestPrice *float64 `json:"ppmDestPrice,omitempty"` - - // Personally Procured Move Fuel Rate Adjusted total cost - PpmFuelRateAdjTotal *float64 `json:"ppmFuelRateAdjTotal,omitempty"` - - // Personally Procured Move Linehaul total cost - PpmLinehaul *float64 `json:"ppmLinehaul,omitempty"` - - // ppm origin price - PpmOriginPrice *float64 `json:"ppmOriginPrice,omitempty"` - - // ppm packing - PpmPacking *float64 `json:"ppmPacking,omitempty"` - - // ppm storage - PpmStorage *float64 `json:"ppmStorage,omitempty"` - - // ppm total - PpmTotal *float64 `json:"ppmTotal,omitempty"` - - // ppm unpacking - PpmUnpacking *float64 `json:"ppmUnpacking,omitempty"` - - // shipment Id - // Format: uuid - ShipmentID strfmt.UUID `json:"shipmentId,omitempty"` - - // shipment type - ShipmentType string `json:"shipmentType,omitempty"` - - // shuttle total - ShuttleTotal *float64 `json:"shuttleTotal,omitempty"` - - // Storage in Transit delivery total cost - SitDeliveryTotal *float64 `json:"sitDeliveryTotal,omitempty"` - - // Additional day of Destination Storage in Transit cost - SitDestAddlDaysTotal *float64 `json:"sitDestAddlDaysTotal,omitempty"` - - // First day of Destination Storage in Transit cost - SitDestFirstDayTotal *float64 `json:"sitDestFirstDayTotal,omitempty"` - - // Storage in Transit destination total cost - SitDestFuelSurcharge *float64 `json:"sitDestFuelSurcharge,omitempty"` - - // Storage in Transit In Date - // Format: date - SitInDate *strfmt.Date `json:"sitInDate,omitempty"` - - // Additional day of Origin Storage in Transit cost - SitOriginAddlDaysTotal *float64 `json:"sitOriginAddlDaysTotal,omitempty"` - - // First day of Origin Storage in Transit cost - SitOriginFirstDayTotal *float64 `json:"sitOriginFirstDayTotal,omitempty"` - - // Storage in Transit origin fuel total cost - SitOriginFuelSurcharge *float64 `json:"sitOriginFuelSurcharge,omitempty"` - - // Storage in Transit Out Date - // Format: date - SitOutDate *strfmt.Date `json:"sitOutDate,omitempty"` - - // Storage in Transit pickup total cost - SitPickupTotal *float64 `json:"sitPickupTotal,omitempty"` - - // Storage in Transit type - // Example: Destination - SitType *string `json:"sitType,omitempty"` - - // LoaInstlAcntgActID in lines_of_accounting - SubAllotCD *string `json:"subAllotCD,omitempty"` - - // LoaObjClsID in lines_of_accounting - Subhead *string `json:"subhead,omitempty"` - - // travel advance - TravelAdvance *float64 `json:"travelAdvance,omitempty"` - - // LoaJbOrdNm in lines_of_accounting - TypeCD *string `json:"typeCD,omitempty"` - - // uncrating total - UncratingTotal *float64 `json:"uncratingTotal,omitempty"` - - // unpacking price - UnpackingPrice *float64 `json:"unpackingPrice,omitempty"` - - // Total weight estimate - WeightEstimate *float64 `json:"weightEstimate,omitempty"` -} - -// Validate validates this p p t a s shipment -func (m *PPTASShipment) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateCratingDimensions(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDd2278IssueDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDeliveryDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDestinationAddress(formats); err != nil { - res = append(res, err) - } - - if err := m.validateMoveDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateOriginAddress(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePaidDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePickupDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateShipmentID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSitInDate(formats); err != nil { - res = append(res, err) - } - - if err := m.validateSitOutDate(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PPTASShipment) validateCratingDimensions(formats strfmt.Registry) error { - if swag.IsZero(m.CratingDimensions) { // not required - return nil - } - - for i := 0; i < len(m.CratingDimensions); i++ { - if swag.IsZero(m.CratingDimensions[i]) { // not required - continue - } - - if m.CratingDimensions[i] != nil { - if err := m.CratingDimensions[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cratingDimensions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cratingDimensions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PPTASShipment) validateDd2278IssueDate(formats strfmt.Registry) error { - if swag.IsZero(m.Dd2278IssueDate) { // not required - return nil - } - - if err := validate.FormatOf("dd2278IssueDate", "body", "date", m.Dd2278IssueDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateDeliveryDate(formats strfmt.Registry) error { - if swag.IsZero(m.DeliveryDate) { // not required - return nil - } - - if err := validate.FormatOf("deliveryDate", "body", "date", m.DeliveryDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateDestinationAddress(formats strfmt.Registry) error { - if swag.IsZero(m.DestinationAddress) { // not required - return nil - } - - if m.DestinationAddress != nil { - if err := m.DestinationAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("destinationAddress") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("destinationAddress") - } - return err - } - } - - return nil -} - -func (m *PPTASShipment) validateMoveDate(formats strfmt.Registry) error { - if swag.IsZero(m.MoveDate) { // not required - return nil - } - - if err := validate.FormatOf("moveDate", "body", "date", m.MoveDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateOriginAddress(formats strfmt.Registry) error { - if swag.IsZero(m.OriginAddress) { // not required - return nil - } - - if m.OriginAddress != nil { - if err := m.OriginAddress.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("originAddress") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("originAddress") - } - return err - } - } - - return nil -} - -func (m *PPTASShipment) validatePaidDate(formats strfmt.Registry) error { - if swag.IsZero(m.PaidDate) { // not required - return nil - } - - if err := validate.FormatOf("paidDate", "body", "date", m.PaidDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validatePickupDate(formats strfmt.Registry) error { - if swag.IsZero(m.PickupDate) { // not required - return nil - } - - if err := validate.FormatOf("pickupDate", "body", "date", m.PickupDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateShipmentID(formats strfmt.Registry) error { - if swag.IsZero(m.ShipmentID) { // not required - return nil - } - - if err := validate.FormatOf("shipmentId", "body", "uuid", m.ShipmentID.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateSitInDate(formats strfmt.Registry) error { - if swag.IsZero(m.SitInDate) { // not required - return nil - } - - if err := validate.FormatOf("sitInDate", "body", "date", m.SitInDate.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *PPTASShipment) validateSitOutDate(formats strfmt.Registry) error { - if swag.IsZero(m.SitOutDate) { // not required - return nil - } - - if err := validate.FormatOf("sitOutDate", "body", "date", m.SitOutDate.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this p p t a s shipment based on the context it is used -func (m *PPTASShipment) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateCratingDimensions(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateDestinationAddress(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateOriginAddress(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *PPTASShipment) contextValidateCratingDimensions(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.CratingDimensions); i++ { - - if m.CratingDimensions[i] != nil { - - if swag.IsZero(m.CratingDimensions[i]) { // not required - return nil - } - - if err := m.CratingDimensions[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("cratingDimensions" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("cratingDimensions" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *PPTASShipment) contextValidateDestinationAddress(ctx context.Context, formats strfmt.Registry) error { - - if m.DestinationAddress != nil { - - if swag.IsZero(m.DestinationAddress) { // not required - return nil - } - - if err := m.DestinationAddress.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("destinationAddress") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("destinationAddress") - } - return err - } - } - - return nil -} - -func (m *PPTASShipment) contextValidateOriginAddress(ctx context.Context, formats strfmt.Registry) error { - - if m.OriginAddress != nil { - - if swag.IsZero(m.OriginAddress) { // not required - return nil - } - - if err := m.OriginAddress.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("originAddress") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("originAddress") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *PPTASShipment) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *PPTASShipment) UnmarshalBinary(b []byte) error { - var res PPTASShipment - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/handlers/pptasapi/api.go b/pkg/handlers/pptasapi/api.go index 7278f68c0dd..421d3bbcc18 100644 --- a/pkg/handlers/pptasapi/api.go +++ b/pkg/handlers/pptasapi/api.go @@ -8,12 +8,7 @@ import ( "github.com/transcom/mymove/pkg/gen/pptasapi" pptasops "github.com/transcom/mymove/pkg/gen/pptasapi/pptasoperations" "github.com/transcom/mymove/pkg/handlers" - paymentrequesthelper "github.com/transcom/mymove/pkg/payment_request" - lineofaccounting "github.com/transcom/mymove/pkg/services/line_of_accounting" - "github.com/transcom/mymove/pkg/services/move" - "github.com/transcom/mymove/pkg/services/ppmshipment" - report "github.com/transcom/mymove/pkg/services/pptas_report" - transportationaccountingcode "github.com/transcom/mymove/pkg/services/transportation_accounting_code" + movetaskorder "github.com/transcom/mymove/pkg/services/move_task_order" ) func NewPPTASAPI(handlerConfig handlers.HandlerConfig) *pptasops.MymoveAPI { @@ -24,14 +19,9 @@ func NewPPTASAPI(handlerConfig handlers.HandlerConfig) *pptasops.MymoveAPI { pptasAPI := pptasops.NewMymoveAPI(pptasSpec) pptasAPI.ServeError = handlers.ServeCustomError - ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{}) - moveFetcher := move.NewMoveFetcher() - tacFetcher := transportationaccountingcode.NewTransportationAccountingCodeFetcher() - loaFetcher := lineofaccounting.NewLinesOfAccountingFetcher(tacFetcher) - - pptasAPI.MovesPptasReportsHandler = PPTASReportsHandler{ - HandlerConfig: handlerConfig, - PPTASReportListFetcher: report.NewPPTASReportListFetcher(ppmEstimator, moveFetcher, tacFetcher, loaFetcher), + pptasAPI.MovesListMovesHandler = ListMovesHandler{ + HandlerConfig: handlerConfig, + MoveTaskOrderFetcher: movetaskorder.NewMoveTaskOrderFetcher(), } return pptasAPI diff --git a/pkg/handlers/pptasapi/internal/payloads/model_to_payload.go b/pkg/handlers/pptasapi/internal/payloads/model_to_payload.go index dcb720369d9..5fc0e934a60 100644 --- a/pkg/handlers/pptasapi/internal/payloads/model_to_payload.go +++ b/pkg/handlers/pptasapi/internal/payloads/model_to_payload.go @@ -4,7 +4,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/gofrs/uuid" - "github.com/transcom/mymove/pkg/appcontext" "github.com/transcom/mymove/pkg/etag" "github.com/transcom/mymove/pkg/gen/pptasmessages" "github.com/transcom/mymove/pkg/handlers" @@ -26,121 +25,36 @@ func InternalServerError(detail *string, traceID uuid.UUID) *pptasmessages.Clien return &payload } -// PPTASReport payload -func PPTASReport(appCtx appcontext.AppContext, pptasReport *models.PPTASReport) *pptasmessages.PPTASReport { - if pptasReport == nil { +// ListMove payload +func ListMove(move *models.Move) *pptasmessages.ListMove { + if move == nil { return nil } - - payload := &pptasmessages.PPTASReport{ - MiddleInitial: pptasReport.MiddleInitial, - PhoneSecondary: pptasReport.PhoneSecondary, - EmailSecondary: pptasReport.EmailSecondary, - OrdersType: string(pptasReport.OrdersType), - PayGrade: (*string)(pptasReport.PayGrade), - OriginGbloc: pptasReport.OriginGBLOC, - DestinationGbloc: pptasReport.DestinationGBLOC, - DepCD: &pptasReport.DepCD, - Affiliation: (*pptasmessages.Affiliation)(pptasReport.Affiliation), - Tac: pptasReport.TAC, - ShipmentNum: int64(pptasReport.ShipmentNum), - TransmitCD: pptasReport.TransmitCd, - Scac: pptasReport.SCAC, - FinancialReviewFlag: pptasReport.FinancialReviewFlag, - } - - if len(pptasReport.Shipments) > 0 { - payload.Shipments = pptasReport.Shipments - } - - if pptasReport.FirstName != nil { - payload.FirstName = *pptasReport.FirstName - } - - if pptasReport.LastName != nil { - payload.LastName = *pptasReport.LastName - } - - if pptasReport.OrdersDate != nil { - payload.OrdersDate = strfmt.DateTime(*pptasReport.OrdersDate) - } - - if pptasReport.Edipi != nil { - payload.Edipi = *pptasReport.Edipi - } - - if pptasReport.PhonePrimary != nil { - payload.PhonePrimary = *pptasReport.PhonePrimary - } - - if pptasReport.EmailPrimary != nil { - payload.EmailPrimary = *pptasReport.EmailPrimary - } - - if pptasReport.OrdersNumber != nil { - payload.OrdersNumber = *pptasReport.OrdersNumber - } - - if pptasReport.OrderNumber != nil { - payload.OrderNumber = pptasReport.OrderNumber - } - - if pptasReport.Address != nil { - payload.Address = Address(pptasReport.Address) - } - - if pptasReport.EntitlementWeight != nil { - payload.EntitlementWeight = models.Int64Pointer(pptasReport.EntitlementWeight.Int64()) - } - - if pptasReport.WeightAuthorized != nil { - payload.WeightAuthorized = models.Float64Pointer(pptasReport.WeightAuthorized.Float64()) - } - - if pptasReport.TravelType != nil { - payload.TravelType = *pptasReport.TravelType + payload := &pptasmessages.ListMove{ + ID: strfmt.UUID(move.ID.String()), + MoveCode: move.Locator, + CreatedAt: strfmt.DateTime(move.CreatedAt), + AvailableToPrimeAt: handlers.FmtDateTimePtr(move.AvailableToPrimeAt), + OrderID: strfmt.UUID(move.OrdersID.String()), + ReferenceID: *move.ReferenceID, + UpdatedAt: strfmt.DateTime(move.UpdatedAt), + ETag: etag.GenerateEtag(move.UpdatedAt), } - if pptasReport.TravelClassCode != nil { - payload.TravelClassCode = *pptasReport.TravelClassCode - } - - if pptasReport.CounseledDate != nil { - payload.CounseledDate = strfmt.Date(*pptasReport.CounseledDate) - } - - if pptasReport.FinancialReviewRemarks != nil { - payload.FinancialReviewRemarks = pptasReport.FinancialReviewRemarks + if move.PPMType != nil { + payload.PpmType = *move.PPMType } return payload } -// PPTASReports payload -func PPTASReports(appCtx appcontext.AppContext, pptasReports *models.PPTASReports) []*pptasmessages.PPTASReport { - payload := make(pptasmessages.PPTASReports, len(*pptasReports)) +// ListMoves payload +func ListMoves(moves *models.Moves) []*pptasmessages.ListMove { + payload := make(pptasmessages.ListMoves, len(*moves)) - for i, pptasReport := range *pptasReports { - copyOfPPTASReport := pptasReport // Make copy to avoid implicit memory aliasing of items from a range statement. - payload[i] = PPTASReport(appCtx, ©OfPPTASReport) + for i, m := range *moves { + copyOfM := m // Make copy to avoid implicit memory aliasing of items from a range statement. + payload[i] = ListMove(©OfM) } return payload } - -func Address(address *models.Address) *pptasmessages.Address { - if address == nil { - return nil - } - return &pptasmessages.Address{ - ID: strfmt.UUID(address.ID.String()), - StreetAddress1: &address.StreetAddress1, - StreetAddress2: address.StreetAddress2, - StreetAddress3: address.StreetAddress3, - City: &address.City, - State: &address.State, - PostalCode: &address.PostalCode, - Country: address.Country, - County: &address.County, - ETag: etag.GenerateEtag(address.UpdatedAt), - } -} diff --git a/pkg/handlers/pptasapi/internal/payloads/model_to_payload_test.go b/pkg/handlers/pptasapi/internal/payloads/model_to_payload_test.go deleted file mode 100644 index b6ceaa53470..00000000000 --- a/pkg/handlers/pptasapi/internal/payloads/model_to_payload_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package payloads - -import ( - "time" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/gen/internalmessages" - "github.com/transcom/mymove/pkg/handlers" - "github.com/transcom/mymove/pkg/models" -) - -func (suite *PayloadsSuite) TestInternalServerError() { - traceID, _ := uuid.NewV4() - detail := "Err" - - noDetailError := InternalServerError(nil, traceID) - suite.Equal(handlers.InternalServerErrMessage, *noDetailError.Title) - suite.Equal(handlers.InternalServerErrDetail, *noDetailError.Detail) - suite.Equal(traceID.String(), noDetailError.Instance.String()) - - detailError := InternalServerError(&detail, traceID) - suite.Equal(handlers.InternalServerErrMessage, *detailError.Title) - suite.Equal(detail, *detailError.Detail) - suite.Equal(traceID.String(), detailError.Instance.String()) -} - -func (suite *PayloadsSuite) TestReport() { - appCtx := suite.AppContextForTest() - now := time.Now() - - // Setup data - report := models.PPTASReport{ - FirstName: models.StringPointer("John"), - LastName: models.StringPointer("Doe"), - MiddleInitial: models.StringPointer("A"), - Edipi: models.StringPointer("1234567890"), - PhonePrimary: models.StringPointer("555-555-5555"), - EmailPrimary: models.StringPointer("john.doe@example.com"), - Address: &models.Address{ - StreetAddress1: "123 Main St", - City: "Some City", - State: "NY", - PostalCode: "10001", - County: "Some County", - }, - OrdersDate: &now, - TAC: models.StringPointer("CACI"), - OrdersType: internalmessages.OrdersTypePERMANENTCHANGEOFSTATION, - OrdersNumber: models.StringPointer("123456"), - } - - suite.Run("valid report", func() { - payload := PPTASReport(appCtx, &report) - - suite.NotNil(payload) - suite.Equal(*report.FirstName, payload.FirstName) - suite.Equal(*report.LastName, payload.LastName) - suite.Equal("A", *payload.MiddleInitial) - suite.Equal(*report.Edipi, payload.Edipi) - suite.Equal(*report.PhonePrimary, payload.PhonePrimary) - suite.Equal(*report.EmailPrimary, payload.EmailPrimary) - suite.Equal(*report.OrdersNumber, payload.OrdersNumber) - suite.Equal(int64(report.ShipmentNum), payload.ShipmentNum) - }) - - suite.Run("nil report", func() { - payload := PPTASReport(appCtx, nil) - - suite.Nil(payload) - }) -} diff --git a/pkg/handlers/pptasapi/internal/payloads/payloads_test.go b/pkg/handlers/pptasapi/internal/payloads/payloads_test.go deleted file mode 100644 index 3ec8f8386dd..00000000000 --- a/pkg/handlers/pptasapi/internal/payloads/payloads_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package payloads - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/transcom/mymove/pkg/handlers" - "github.com/transcom/mymove/pkg/notifications" - "github.com/transcom/mymove/pkg/testingsuite" -) - -// HandlerSuite is an abstraction of our original suite -type PayloadsSuite struct { - handlers.BaseHandlerTestSuite -} - -// TestHandlerSuite creates our test suite -func TestHandlerSuite(t *testing.T) { - hs := &PayloadsSuite{ - BaseHandlerTestSuite: handlers.NewBaseHandlerTestSuite(notifications.NewStubNotificationSender("milmovelocal"), testingsuite.CurrentPackage(), - testingsuite.WithPerTestTransaction()), - } - - suite.Run(t, hs) - hs.PopTestSuite.TearDown() -} diff --git a/pkg/handlers/pptasapi/moves.go b/pkg/handlers/pptasapi/moves.go new file mode 100644 index 00000000000..62f6fc20fa5 --- /dev/null +++ b/pkg/handlers/pptasapi/moves.go @@ -0,0 +1,42 @@ +package pptasapi + +import ( + "github.com/go-openapi/runtime/middleware" + "go.uber.org/zap" + + "github.com/transcom/mymove/pkg/appcontext" + pptasop "github.com/transcom/mymove/pkg/gen/pptasapi/pptasoperations/moves" + "github.com/transcom/mymove/pkg/handlers" + "github.com/transcom/mymove/pkg/handlers/pptasapi/internal/payloads" + "github.com/transcom/mymove/pkg/services" +) + +// ListMovesHandler lists moves with the option to filter since a particular date. Optimized ver. +type ListMovesHandler struct { + handlers.HandlerConfig + services.MoveTaskOrderFetcher +} + +// Handle fetches all moves with the option to filter since a particular date. Optimized version. +func (h ListMovesHandler) Handle(params pptasop.ListMovesParams) middleware.Responder { + return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, + func(appCtx appcontext.AppContext) (middleware.Responder, error) { + + var searchParams services.MoveTaskOrderFetcherParams + if params.Since != nil { + since := handlers.FmtDateTimePtrToPop(params.Since) + searchParams.Since = &since + } + + mtos, err := h.MoveTaskOrderFetcher.ListPrimeMoveTaskOrders(appCtx, &searchParams) + + if err != nil { + appCtx.Logger().Error("Unexpected error while fetching moves:", zap.Error(err)) + return pptasop.NewListMovesInternalServerError().WithPayload(payloads.InternalServerError(nil, h.GetTraceIDFromRequest(params.HTTPRequest))), err + } + + payload := payloads.ListMoves(&mtos) + + return pptasop.NewListMovesOK().WithPayload(payload), nil + }) +} diff --git a/pkg/handlers/pptasapi/pptas_report.go b/pkg/handlers/pptasapi/pptas_report.go deleted file mode 100644 index 01faf6ddd08..00000000000 --- a/pkg/handlers/pptasapi/pptas_report.go +++ /dev/null @@ -1,46 +0,0 @@ -package pptasapi - -import ( - "github.com/go-openapi/runtime/middleware" - "go.uber.org/zap" - - "github.com/transcom/mymove/pkg/appcontext" - pptasop "github.com/transcom/mymove/pkg/gen/pptasapi/pptasoperations/moves" - "github.com/transcom/mymove/pkg/handlers" - "github.com/transcom/mymove/pkg/handlers/pptasapi/internal/payloads" - "github.com/transcom/mymove/pkg/services" -) - -// PPTASReportsHandler lists reports with the option to filter since a particular date. Optimized ver. -type PPTASReportsHandler struct { - handlers.HandlerConfig - services.PPTASReportListFetcher -} - -// Handle fetches all reports with the option to filter since a particular date. Optimized version. -func (h PPTASReportsHandler) Handle(params pptasop.PptasReportsParams) middleware.Responder { - return h.AuditableAppContextFromRequestWithErrors(params.HTTPRequest, - func(appCtx appcontext.AppContext) (middleware.Responder, error) { - var searchParams services.MoveTaskOrderFetcherParams - if params.Since != nil { - since := handlers.FmtDateTimePtrToPop(params.Since) - searchParams.Since = &since - } - - movesForReport, err := h.GetMovesForReportBuilder(appCtx, &searchParams) - if err != nil { - appCtx.Logger().Error("Unexpected error while fetching moves:", zap.Error(err)) - return pptasop.NewPptasReportsInternalServerError().WithPayload(payloads.InternalServerError(nil, h.GetTraceIDFromRequest(params.HTTPRequest))), err - } - - pptasReports, err := h.BuildPPTASReportsFromMoves(appCtx, movesForReport) - if err != nil { - appCtx.Logger().Error("Unexpected error while fetching reports:", zap.Error(err)) - return pptasop.NewPptasReportsInternalServerError().WithPayload(payloads.InternalServerError(nil, h.GetTraceIDFromRequest(params.HTTPRequest))), err - } - - payload := payloads.PPTASReports(appCtx, &pptasReports) - - return pptasop.NewPptasReportsOK().WithPayload(payload), nil - }) -} diff --git a/pkg/models/move.go b/pkg/models/move.go index 7cddcc3c12c..aef105de3e0 100644 --- a/pkg/models/move.go +++ b/pkg/models/move.go @@ -608,18 +608,6 @@ func GetTotalNetWeightForMove(m Move) unit.Pound { } -// gets total weight from all ppm and hhg shipments within a move -func GetTotalNetWeightForMTOShipment(s MTOShipment) unit.Pound { - totalNetWeight := unit.Pound(0) - if s.ShipmentType == MTOShipmentTypePPM && s.PPMShipment != nil { - totalNetWeight += GetPPMNetWeight(*s.PPMShipment) - } else if s.PrimeActualWeight != nil { - totalNetWeight += *s.PrimeActualWeight - } - - return totalNetWeight -} - // HasPPM returns true if at least one shipment type is "PPM" associated with the move, false otherwise func (m Move) HasPPM() bool { if len(m.MTOShipments) == 0 { diff --git a/pkg/models/pptas_report.go b/pkg/models/pptas_report.go deleted file mode 100644 index 9e262301c9b..00000000000 --- a/pkg/models/pptas_report.go +++ /dev/null @@ -1,109 +0,0 @@ -package models - -import ( - "time" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/gen/internalmessages" - "github.com/transcom/mymove/pkg/gen/pptasmessages" - "github.com/transcom/mymove/pkg/unit" -) - -// PPTAS PPTASReport -type PPTASReport struct { - FirstName *string - LastName *string - MiddleInitial *string - Affiliation *ServiceMemberAffiliation - PayGrade *internalmessages.OrderPayGrade - Edipi *string - PhonePrimary *string - PhoneSecondary *string - EmailPrimary *string - EmailSecondary *string - Address *Address - OrdersType internalmessages.OrdersType - OrdersNumber *string - OrdersDate *time.Time - TravelClassCode *string - OriginGBLOC *string - DestinationGBLOC *string - DepCD bool - TAC *string - ShipmentNum int - TransmitCd *string - SCAC *string - CounseledDate *time.Time - WeightAuthorized *unit.Pound - EntitlementWeight *unit.Pound - OrderNumber *string - TravelType *string - FinancialReviewFlag *bool - FinancialReviewRemarks *string - Shipments []*pptasmessages.PPTASShipment -} - -type PPTASReports []PPTASReport - -type PPTASShipment struct { - OriginAddress *Address - DestinationAddress *Address - TravelAdvance *unit.Cents - MoveDate *time.Time - FiscalYear *string - Appro *string - Subhead *string - ObjClass *string - BCN *string - SubAllotCD *string - AAA *string - TypeCD *string - PAA *string - CostCD *string - DDCD *string - WeightEstimate *unit.Pound - DD2278IssueDate *time.Time - Miles *unit.Miles - ShipmentId uuid.UUID - LOA *string - ShipmentType *string - NetWeight *unit.Pound - PBPAndE *unit.Pound - PickupDate *time.Time - SitInDate *time.Time - SitOutDate *time.Time - SitType *string - PaidDate *time.Time - LinehaulTotal *float64 - LinehaulFuelTotal *float64 - OriginPrice *float64 - DestinationPrice *float64 - PackingPrice *float64 - UnpackingPrice *float64 - SITOriginFirstDayTotal *float64 - SITOriginAddlDaysTotal *float64 - SITDestFirstDayTotal *float64 - SITDestAddlDaysTotal *float64 - SITPickupTotal *float64 - SITDeliveryTotal *float64 - SITOriginFuelSurcharge *float64 - SITDestFuelSurcharge *float64 - CratingTotal *float64 - UncratingTotal *float64 - CratingDimensions []*pptasmessages.Crate - ShuttleTotal *float64 - MoveManagementFeeTotal *float64 - CounselingFeeTotal *float64 - InvoicePaidAmt *float64 - PpmLinehaul *float64 - PpmFuelRateAdjTotal *float64 - PpmOriginPrice *float64 - PpmDestPrice *float64 - PpmPacking *float64 - PpmUnpacking *float64 - PpmTotal *float64 - DeliveryDate *time.Time - ActualOriginNetWeight *unit.Pound - DestinationReweighNetWeight *unit.Pound -} diff --git a/pkg/services/line_of_accounting.go b/pkg/services/line_of_accounting.go index 591c4ff9a90..2d4f45beacd 100644 --- a/pkg/services/line_of_accounting.go +++ b/pkg/services/line_of_accounting.go @@ -13,5 +13,4 @@ import ( //go:generate mockery --name LineOfAccountingFetcher type LineOfAccountingFetcher interface { FetchLongLinesOfAccounting(serviceMemberAffiliation models.ServiceMemberAffiliation, ordersIssueDate time.Time, tacCode string, appCtx appcontext.AppContext) ([]models.LineOfAccounting, error) - BuildFullLineOfAccountingString(loa models.LineOfAccounting) string } diff --git a/pkg/services/line_of_accounting/line_of_accounting_fetcher.go b/pkg/services/line_of_accounting/line_of_accounting_fetcher.go index d020373a59c..0af1673c3c7 100644 --- a/pkg/services/line_of_accounting/line_of_accounting_fetcher.go +++ b/pkg/services/line_of_accounting/line_of_accounting_fetcher.go @@ -1,9 +1,7 @@ package lineofaccounting import ( - "fmt" "sort" - "strings" "time" "go.uber.org/zap" @@ -220,132 +218,3 @@ func checkForValidHhgProgramCodeForLoaAndValidLoaForTac(linesOfAccounting []mode return linesOfAccounting, err } - -func (f linesOfAccountingFetcher) BuildFullLineOfAccountingString(loa models.LineOfAccounting) string { - emptyString := "" - var loaFyTx string - if fmt.Sprint(*loa.LoaBgFyTx) != "" && fmt.Sprint(*loa.LoaEndFyTx) != "" { - loaFyTx = fmt.Sprint(*loa.LoaBgFyTx) + fmt.Sprint(*loa.LoaEndFyTx) - } else { - loaFyTx = "" - } - - if loa.LoaDptID == nil { - loa.LoaDptID = &emptyString - } - if loa.LoaTnsfrDptNm == nil { - loa.LoaTnsfrDptNm = &emptyString - } - if loa.LoaBafID == nil { - loa.LoaBafID = &emptyString - } - if loa.LoaTrsySfxTx == nil { - loa.LoaTrsySfxTx = &emptyString - } - if loa.LoaMajClmNm == nil { - loa.LoaMajClmNm = &emptyString - } - if loa.LoaOpAgncyID == nil { - loa.LoaOpAgncyID = &emptyString - } - if loa.LoaAlltSnID == nil { - loa.LoaAlltSnID = &emptyString - } - if loa.LoaUic == nil { - loa.LoaUic = &emptyString - } - if loa.LoaPgmElmntID == nil { - loa.LoaPgmElmntID = &emptyString - } - if loa.LoaTskBdgtSblnTx == nil { - loa.LoaTskBdgtSblnTx = &emptyString - } - if loa.LoaDfAgncyAlctnRcpntID == nil { - loa.LoaDfAgncyAlctnRcpntID = &emptyString - } - if loa.LoaJbOrdNm == nil { - loa.LoaJbOrdNm = &emptyString - } - if loa.LoaSbaltmtRcpntID == nil { - loa.LoaSbaltmtRcpntID = &emptyString - } - if loa.LoaWkCntrRcpntNm == nil { - loa.LoaWkCntrRcpntNm = &emptyString - } - if loa.LoaMajRmbsmtSrcID == nil { - loa.LoaMajRmbsmtSrcID = &emptyString - } - if loa.LoaDtlRmbsmtSrcID == nil { - loa.LoaDtlRmbsmtSrcID = &emptyString - } - if loa.LoaCustNm == nil { - loa.LoaCustNm = &emptyString - } - if loa.LoaObjClsID == nil { - loa.LoaObjClsID = &emptyString - } - if loa.LoaSrvSrcID == nil { - loa.LoaSrvSrcID = &emptyString - } - if loa.LoaSpclIntrID == nil { - loa.LoaSpclIntrID = &emptyString - } - if loa.LoaBdgtAcntClsNm == nil { - loa.LoaBdgtAcntClsNm = &emptyString - } - if loa.LoaDocID == nil { - loa.LoaDocID = &emptyString - } - if loa.LoaClsRefID == nil { - loa.LoaClsRefID = &emptyString - } - if loa.LoaInstlAcntgActID == nil { - loa.LoaInstlAcntgActID = &emptyString - } - if loa.LoaLclInstlID == nil { - loa.LoaLclInstlID = &emptyString - } - if loa.LoaTrnsnID == nil { - loa.LoaTrnsnID = &emptyString - } - if loa.LoaFmsTrnsactnID == nil { - loa.LoaFmsTrnsactnID = &emptyString - } - - // commented names are Navy PPTAS equivalents - LineOfAccountingDfasElementOrder := []string{ - *loa.LoaDptID, // "LoaDptID" - *loa.LoaTnsfrDptNm, // "LoaTnsfrDptNm", - loaFyTx, // "LoaEndFyTx", - *loa.LoaBafID, // "LoaBafID", - *loa.LoaTrsySfxTx, // "LoaTrsySfxTx", - *loa.LoaMajClmNm, // "LoaMajClmNm", - *loa.LoaOpAgncyID, // "LoaOpAgncyID", - *loa.LoaAlltSnID, // "LoaAlltSnID", - *loa.LoaUic, // "LoaUic", - *loa.LoaPgmElmntID, // "LoaPgmElmntID", - *loa.LoaTskBdgtSblnTx, // "LoaTskBdgtSblnTx", - *loa.LoaDfAgncyAlctnRcpntID, // "LoaDfAgncyAlctnRcpntID", - *loa.LoaJbOrdNm, // "LoaJbOrdNm", - *loa.LoaSbaltmtRcpntID, // "LoaSbaltmtRcpntID", - *loa.LoaWkCntrRcpntNm, // "LoaWkCntrRcpntNm", - *loa.LoaMajRmbsmtSrcID, // "LoaMajRmbsmtSrcID", - *loa.LoaDtlRmbsmtSrcID, // "LoaDtlRmbsmtSrcID", - *loa.LoaCustNm, // "LoaCustNm", - *loa.LoaObjClsID, // "LoaObjClsID", - *loa.LoaSrvSrcID, // "LoaSrvSrcID", - *loa.LoaSpclIntrID, // "LoaSpcLIntrID", - *loa.LoaBdgtAcntClsNm, // "LoaBdgtAcntCLsNm", - *loa.LoaDocID, // "LoaDocID", - *loa.LoaClsRefID, // "LoaCLsRefID", - *loa.LoaInstlAcntgActID, // "LoaInstLAcntgActID", - *loa.LoaLclInstlID, // "LoaLcLInstLID", - *loa.LoaTrnsnID, // "LoaTrnsnID", - *loa.LoaFmsTrnsactnID, // "LoaFmsTrnsactnID", - } - - longLoa := strings.Join(LineOfAccountingDfasElementOrder, "*") - longLoa = strings.ReplaceAll(longLoa, " *", "*") - - return longLoa -} diff --git a/pkg/services/mocks/LineOfAccountingFetcher.go b/pkg/services/mocks/LineOfAccountingFetcher.go index ba1c54de614..d7c0f1ba7be 100644 --- a/pkg/services/mocks/LineOfAccountingFetcher.go +++ b/pkg/services/mocks/LineOfAccountingFetcher.go @@ -16,20 +16,6 @@ type LineOfAccountingFetcher struct { mock.Mock } -// BuildFullLineOfAccountingString provides a mock function with given fields: loa -func (_m *LineOfAccountingFetcher) BuildFullLineOfAccountingString(loa models.LineOfAccounting) string { - ret := _m.Called(loa) - - var r0 string - if rf, ok := ret.Get(0).(func(models.LineOfAccounting) string); ok { - r0 = rf(loa) - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // FetchLongLinesOfAccounting provides a mock function with given fields: serviceMemberAffiliation, ordersIssueDate, tacCode, appCtx func (_m *LineOfAccountingFetcher) FetchLongLinesOfAccounting(serviceMemberAffiliation models.ServiceMemberAffiliation, ordersIssueDate time.Time, tacCode string, appCtx appcontext.AppContext) ([]models.LineOfAccounting, error) { ret := _m.Called(serviceMemberAffiliation, ordersIssueDate, tacCode, appCtx) diff --git a/pkg/services/mocks/MoveFetcher.go b/pkg/services/mocks/MoveFetcher.go index f3f1155b0ee..4327853d67f 100644 --- a/pkg/services/mocks/MoveFetcher.go +++ b/pkg/services/mocks/MoveFetcher.go @@ -42,32 +42,6 @@ func (_m *MoveFetcher) FetchMove(appCtx appcontext.AppContext, locator string, s return r0, r1 } -// FetchMovesForPPTASReports provides a mock function with given fields: appCtx, params -func (_m *MoveFetcher) FetchMovesForPPTASReports(appCtx appcontext.AppContext, params *services.MoveTaskOrderFetcherParams) (models.Moves, error) { - ret := _m.Called(appCtx, params) - - var r0 models.Moves - var r1 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) (models.Moves, error)); ok { - return rf(appCtx, params) - } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) models.Moves); ok { - r0 = rf(appCtx, params) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(models.Moves) - } - } - - if rf, ok := ret.Get(1).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) error); ok { - r1 = rf(appCtx, params) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // NewMoveFetcher creates a new instance of MoveFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMoveFetcher(t interface { diff --git a/pkg/services/mocks/PPMEstimator.go b/pkg/services/mocks/PPMEstimator.go index 1238fb0c816..dfd8860a3d6 100644 --- a/pkg/services/mocks/PPMEstimator.go +++ b/pkg/services/mocks/PPMEstimator.go @@ -129,72 +129,6 @@ func (_m *PPMEstimator) FinalIncentiveWithDefaultChecks(appCtx appcontext.AppCon return r0, r1 } -// PriceBreakdown provides a mock function with given fields: appCtx, ppmShipment -func (_m *PPMEstimator) PriceBreakdown(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, error) { - ret := _m.Called(appCtx, ppmShipment) - - var r0 unit.Cents - var r1 unit.Cents - var r2 unit.Cents - var r3 unit.Cents - var r4 unit.Cents - var r5 unit.Cents - var r6 unit.Cents - var r7 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *models.PPMShipment) (unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, error)); ok { - return rf(appCtx, ppmShipment) - } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r0 = rf(appCtx, ppmShipment) - } else { - r0 = ret.Get(0).(unit.Cents) - } - - if rf, ok := ret.Get(1).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r1 = rf(appCtx, ppmShipment) - } else { - r1 = ret.Get(1).(unit.Cents) - } - - if rf, ok := ret.Get(2).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r2 = rf(appCtx, ppmShipment) - } else { - r2 = ret.Get(2).(unit.Cents) - } - - if rf, ok := ret.Get(3).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r3 = rf(appCtx, ppmShipment) - } else { - r3 = ret.Get(3).(unit.Cents) - } - - if rf, ok := ret.Get(4).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r4 = rf(appCtx, ppmShipment) - } else { - r4 = ret.Get(4).(unit.Cents) - } - - if rf, ok := ret.Get(5).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r5 = rf(appCtx, ppmShipment) - } else { - r5 = ret.Get(5).(unit.Cents) - } - - if rf, ok := ret.Get(6).(func(appcontext.AppContext, *models.PPMShipment) unit.Cents); ok { - r6 = rf(appCtx, ppmShipment) - } else { - r6 = ret.Get(6).(unit.Cents) - } - - if rf, ok := ret.Get(7).(func(appcontext.AppContext, *models.PPMShipment) error); ok { - r7 = rf(appCtx, ppmShipment) - } else { - r7 = ret.Error(7) - } - - return r0, r1, r2, r3, r4, r5, r6, r7 -} - // NewPPMEstimator creates a new instance of PPMEstimator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewPPMEstimator(t interface { diff --git a/pkg/services/mocks/PPTASReportListFetcher.go b/pkg/services/mocks/PPTASReportListFetcher.go deleted file mode 100644 index 677db372766..00000000000 --- a/pkg/services/mocks/PPTASReportListFetcher.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - appcontext "github.com/transcom/mymove/pkg/appcontext" - - models "github.com/transcom/mymove/pkg/models" - - services "github.com/transcom/mymove/pkg/services" -) - -// PPTASReportListFetcher is an autogenerated mock type for the PPTASReportListFetcher type -type PPTASReportListFetcher struct { - mock.Mock -} - -// BuildPPTASReportsFromMoves provides a mock function with given fields: appCtx, moves -func (_m *PPTASReportListFetcher) BuildPPTASReportsFromMoves(appCtx appcontext.AppContext, moves models.Moves) (models.PPTASReports, error) { - ret := _m.Called(appCtx, moves) - - var r0 models.PPTASReports - var r1 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.Moves) (models.PPTASReports, error)); ok { - return rf(appCtx, moves) - } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.Moves) models.PPTASReports); ok { - r0 = rf(appCtx, moves) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(models.PPTASReports) - } - } - - if rf, ok := ret.Get(1).(func(appcontext.AppContext, models.Moves) error); ok { - r1 = rf(appCtx, moves) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetMovesForReportBuilder provides a mock function with given fields: appCtx, params -func (_m *PPTASReportListFetcher) GetMovesForReportBuilder(appCtx appcontext.AppContext, params *services.MoveTaskOrderFetcherParams) (models.Moves, error) { - ret := _m.Called(appCtx, params) - - var r0 models.Moves - var r1 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) (models.Moves, error)); ok { - return rf(appCtx, params) - } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) models.Moves); ok { - r0 = rf(appCtx, params) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(models.Moves) - } - } - - if rf, ok := ret.Get(1).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) error); ok { - r1 = rf(appCtx, params) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewPPTASReportListFetcher creates a new instance of PPTASReportListFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewPPTASReportListFetcher(t interface { - mock.TestingT - Cleanup(func()) -}) *PPTASReportListFetcher { - mock := &PPTASReportListFetcher{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/services/mocks/ReportListFetcher.go b/pkg/services/mocks/ReportListFetcher.go deleted file mode 100644 index a68ed334dff..00000000000 --- a/pkg/services/mocks/ReportListFetcher.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - appcontext "github.com/transcom/mymove/pkg/appcontext" - - models "github.com/transcom/mymove/pkg/models" - - services "github.com/transcom/mymove/pkg/services" -) - -// ReportListFetcher is an autogenerated mock type for the ReportListFetcher type -type ReportListFetcher struct { - mock.Mock -} - -// BuildReportsFromMoves provides a mock function with given fields: appCtx, params -func (_m *ReportListFetcher) BuildReportsFromMoves(appCtx appcontext.AppContext, params *services.MoveTaskOrderFetcherParams) (models.PPTASReports, error) { - ret := _m.Called(appCtx, params) - - var r0 models.PPTASReports - var r1 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) (models.PPTASReports, error)); ok { - return rf(appCtx, params) - } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) models.PPTASReports); ok { - r0 = rf(appCtx, params) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(models.PPTASReports) - } - } - - if rf, ok := ret.Get(1).(func(appcontext.AppContext, *services.MoveTaskOrderFetcherParams) error); ok { - r1 = rf(appCtx, params) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewReportListFetcher creates a new instance of ReportListFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewReportListFetcher(t interface { - mock.TestingT - Cleanup(func()) -}) *ReportListFetcher { - mock := &ReportListFetcher{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/services/move.go b/pkg/services/move.go index e3d65944db3..61dc21b9179 100644 --- a/pkg/services/move.go +++ b/pkg/services/move.go @@ -25,7 +25,6 @@ type MoveListFetcher interface { //go:generate mockery --name MoveFetcher type MoveFetcher interface { FetchMove(appCtx appcontext.AppContext, locator string, searchParams *MoveFetcherParams) (*models.Move, error) - FetchMovesForPPTASReports(appCtx appcontext.AppContext, params *MoveTaskOrderFetcherParams) (models.Moves, error) } //go:generate mockery --name MoveSearcher diff --git a/pkg/services/move/move_fetcher.go b/pkg/services/move/move_fetcher.go index 00116896e79..4095aca5dc4 100644 --- a/pkg/services/move/move_fetcher.go +++ b/pkg/services/move/move_fetcher.go @@ -59,52 +59,3 @@ func (f moveFetcher) FetchMove(appCtx appcontext.AppContext, locator string, sea return move, nil } - -// Fetches moves for Navy servicemembers with approved shipments. Ignores gbloc rules -func (f moveFetcher) FetchMovesForPPTASReports(appCtx appcontext.AppContext, params *services.MoveTaskOrderFetcherParams) (models.Moves, error) { - var moves models.Moves - - query := appCtx.DB().EagerPreload( - "MTOShipments.DestinationAddress", - "MTOShipments.PickupAddress", - "MTOShipments.SecondaryDeliveryAddress", - "MTOShipments.SecondaryPickupAddress", - "MTOShipments.MTOAgents", - "MTOShipments.Reweigh", - "MTOShipments.PPMShipment", - "Orders.ServiceMember", - "Orders.ServiceMember.ResidentialAddress", - "Orders.ServiceMember.BackupContacts", - "Orders.Entitlement", - "Orders.Entitlement.WeightAllotted", - "Orders.NewDutyLocation.Address", - "Orders.NewDutyLocation.TransportationOffice.Gbloc", - "Orders.OriginDutyLocation.Address", - "Orders.TAC", - ). - InnerJoin("orders", "orders.id = moves.orders_id"). - InnerJoin("entitlements", "entitlements.id = orders.entitlement_id"). - InnerJoin("service_members", "orders.service_member_id = service_members.id"). - InnerJoin("mto_shipments", "mto_shipments.move_id = moves.id"). - LeftJoin("ppm_shipments", "ppm_shipments.shipment_id = mto_shipments.id"). - LeftJoin("addresses", "addresses.id in (mto_shipments.pickup_address_id, mto_shipments.destination_address_id)"). - Where("mto_shipments.status = 'APPROVED'"). - Where("service_members.affiliation = ?", models.AffiliationNAVY). - GroupBy("moves.id") - - if params.Since != nil { - query.Where("mto_shipments.updated_at >= ?", params.Since) - } - - err := query.All(&moves) - - if err != nil { - return nil, err - } - - if len(moves) < 1 { - return nil, nil - } - - return moves, nil -} diff --git a/pkg/services/ppmshipment.go b/pkg/services/ppmshipment.go index 5d5562bd90e..e1ee4951831 100644 --- a/pkg/services/ppmshipment.go +++ b/pkg/services/ppmshipment.go @@ -47,7 +47,6 @@ type PPMDocumentFetcher interface { type PPMEstimator interface { EstimateIncentiveWithDefaultChecks(appCtx appcontext.AppContext, oldPPMShipment models.PPMShipment, newPPMShipment *models.PPMShipment) (*unit.Cents, *unit.Cents, error) FinalIncentiveWithDefaultChecks(appCtx appcontext.AppContext, oldPPMShipment models.PPMShipment, newPPMShipment *models.PPMShipment) (*unit.Cents, error) - PriceBreakdown(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, error) CalculatePPMSITEstimatedCost(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (*unit.Cents, error) CalculatePPMSITEstimatedCostBreakdown(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (*models.PPMSITEstimatedCostInfo, error) } diff --git a/pkg/services/ppmshipment/ppm_estimator.go b/pkg/services/ppmshipment/ppm_estimator.go index ebec38a8848..bd47f53d935 100644 --- a/pkg/services/ppmshipment/ppm_estimator.go +++ b/pkg/services/ppmshipment/ppm_estimator.go @@ -122,10 +122,6 @@ func (f *estimatePPM) FinalIncentiveWithDefaultChecks(appCtx appcontext.AppConte return f.finalIncentive(appCtx, oldPPMShipment, newPPMShipment, f.checks...) } -func (f *estimatePPM) PriceBreakdown(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, error) { - return f.priceBreakdown(appCtx, ppmShipment) -} - func shouldSkipEstimatingIncentive(newPPMShipment *models.PPMShipment, oldPPMShipment *models.PPMShipment) bool { return oldPPMShipment.ExpectedDepartureDate.Equal(newPPMShipment.ExpectedDepartureDate) && newPPMShipment.PickupAddress.PostalCode == oldPPMShipment.PickupAddress.PostalCode && @@ -430,172 +426,6 @@ func (f estimatePPM) calculatePrice(appCtx appcontext.AppContext, ppmShipment *m return &totalPrice, nil } -// returns the final price breakdown of a ppm into linehaul, fuel, packing, unpacking, destination, and origin costs -func (f estimatePPM) priceBreakdown(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment) (unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, unit.Cents, error) { - logger := appCtx.Logger() - - var emptyPrice unit.Cents - var linehaul unit.Cents - var fuel unit.Cents - var origin unit.Cents - var dest unit.Cents - var packing unit.Cents - var unpacking unit.Cents - var storage unit.Cents - - serviceItemsToPrice := BaseServiceItems(ppmShipment.ShipmentID) - - // Replace linehaul pricer with shorthaul pricer if move is within the same Zip3 - var pickupPostal, destPostal string - - // Check different address values for a postal code - if ppmShipment.ActualPickupPostalCode != nil { - pickupPostal = *ppmShipment.ActualPickupPostalCode - } else if ppmShipment.PickupAddress.PostalCode != "" { - pickupPostal = ppmShipment.PickupAddress.PostalCode - } - - // Same for destination - if ppmShipment.ActualDestinationPostalCode != nil { - destPostal = *ppmShipment.ActualDestinationPostalCode - } else if ppmShipment.DestinationAddress.PostalCode != "" { - destPostal = ppmShipment.DestinationAddress.PostalCode - } - - if len(pickupPostal) >= 3 && len(destPostal) >= 3 && pickupPostal[:3] == destPostal[:3] { - if pickupPostal[0:3] == destPostal[0:3] { - serviceItemsToPrice[0] = models.MTOServiceItem{ReService: models.ReService{Code: models.ReServiceCodeDSH}, MTOShipmentID: &ppmShipment.ShipmentID} - } - } - - // Get a list of all the pricing params needed to calculate the price for each service item - paramsForServiceItems, err := f.paymentRequestHelper.FetchServiceParamsForServiceItems(appCtx, serviceItemsToPrice) - if err != nil { - logger.Error("fetching PPM estimate ServiceParams failed", zap.Error(err)) - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - contractDate := ppmShipment.ExpectedDepartureDate - if ppmShipment.ActualMoveDate != nil { - contractDate = *ppmShipment.ActualMoveDate - } - contract, err := serviceparamvaluelookups.FetchContract(appCtx, contractDate) - if err != nil { - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - var totalWeightFromWeightTickets unit.Pound - var blankPPM models.PPMShipment - if ppmShipment.WeightTickets != nil { - _, totalWeightFromWeightTickets = SumWeightTickets(blankPPM, *ppmShipment) - } else { - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, apperror.NewPPMNoWeightTicketsError(ppmShipment.ID, " no weight tickets") - } - - var mtoShipment models.MTOShipment - if totalWeightFromWeightTickets > 0 { - // Reassign ppm shipment fields to their expected location on the mto shipment for dates, addresses, weights ... - mtoShipment = MapPPMShipmentFinalFields(*ppmShipment, totalWeightFromWeightTickets) - } else { - mtoShipment, err = MapPPMShipmentEstimatedFields(appCtx, *ppmShipment) - if err != nil { - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - } - - doSITCalculation := *ppmShipment.SITExpected - if doSITCalculation { - estimatedSITCost, err := CalculateSITCost(appCtx, ppmShipment, contract) - if err != nil { - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - if *estimatedSITCost > unit.Cents(0) { - storage = *estimatedSITCost - } - } - - for _, serviceItem := range serviceItemsToPrice { - pricer, err := ghcrateengine.PricerForServiceItem(serviceItem.ReService.Code) - if err != nil { - logger.Error("unable to find pricer for service item", zap.Error(err)) - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - // For the non-accessorial service items there isn't any initialization that is going to change between lookups - // for the same param. However, this is how the payment request does things and we'd want to know if it breaks - // rather than optimizing I think. - serviceItemLookups := serviceparamvaluelookups.InitializeLookups(appCtx, mtoShipment, serviceItem) - - // This is the struct that gets passed to every param lookup() method that was initialized above - keyData := serviceparamvaluelookups.NewServiceItemParamKeyData(f.planner, serviceItemLookups, serviceItem, mtoShipment, contract.Code) - - // The distance value gets saved to the mto shipment model to reduce repeated api calls. - var shipmentWithDistance models.MTOShipment - err = appCtx.DB().Find(&shipmentWithDistance, ppmShipment.ShipmentID) - if err != nil { - logger.Error("could not find shipment in the database") - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - serviceItem.MTOShipment = shipmentWithDistance - // set this to avoid potential eTag errors because the MTOShipment.Distance field was likely updated - ppmShipment.Shipment = shipmentWithDistance - - var paramValues models.PaymentServiceItemParams - for _, param := range paramsForServiceCode(serviceItem.ReService.Code, paramsForServiceItems) { - paramKey := param.ServiceItemParamKey - // This is where the lookup() method of each service item param is actually evaluated - paramValue, valueErr := keyData.ServiceParamValue(appCtx, paramKey.Key) - if valueErr != nil { - logger.Error("could not calculate param value lookup", zap.Error(valueErr)) - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - // Gather all the param values for the service item to pass to the pricer's Price() method - paymentServiceItemParam := models.PaymentServiceItemParam{ - // Some pricers like Fuel Surcharge try to requery the shipment through the service item, this is a - // workaround to avoid a not found error because our PPM shipment has no service items saved in the db. - // I think the FSC service item should really be relying on one of the zip distance params. - PaymentServiceItem: models.PaymentServiceItem{ - MTOServiceItem: serviceItem, - }, - ServiceItemParamKey: paramKey, - Value: paramValue, - } - paramValues = append(paramValues, paymentServiceItemParam) - } - - if len(paramValues) == 0 { - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, fmt.Errorf("no params were found for service item %s", serviceItem.ReService.Code) - } - - centsValue, _, err := pricer.PriceUsingParams(appCtx, paramValues) - - if err != nil { - logger.Error("unable to calculate service item price", zap.Error(err)) - return emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, emptyPrice, err - } - - switch serviceItem.ReService.Code { - case models.ReServiceCodeDSH: - case models.ReServiceCodeDLH: - linehaul = centsValue - case models.ReServiceCodeFSC: - fuel = centsValue - case models.ReServiceCodeDOP: - origin = centsValue - case models.ReServiceCodeDDP: - dest = centsValue - case models.ReServiceCodeDPK: - packing = centsValue - case models.ReServiceCodeDUPK: - unpacking = centsValue - } - } - - return linehaul, fuel, origin, dest, packing, unpacking, storage, nil -} - func CalculateSITCost(appCtx appcontext.AppContext, ppmShipment *models.PPMShipment, contract models.ReContract) (*unit.Cents, error) { logger := appCtx.Logger() diff --git a/pkg/services/ppmshipment/ppm_estimator_test.go b/pkg/services/ppmshipment/ppm_estimator_test.go index 5c564ae3091..ac982bb33cb 100644 --- a/pkg/services/ppmshipment/ppm_estimator_test.go +++ b/pkg/services/ppmshipment/ppm_estimator_test.go @@ -480,39 +480,6 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }) } - suite.Run("Price Breakdown", func() { - ppmShipment := factory.BuildPPMShipmentWithApprovedDocuments(suite.DB()) - - setupPricerData() - - mockedPaymentRequestHelper.On( - "FetchServiceParamsForServiceItems", - mock.AnythingOfType("*appcontext.appContext"), - mock.AnythingOfType("[]models.MTOServiceItem")).Return(serviceParams, nil) - - // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles - mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813").Return(2294, nil) - - linehaul, fuel, origin, dest, packing, unpacking, _, err := ppmEstimator.PriceBreakdown(suite.AppContextForTest(), &ppmShipment) - suite.NilOrNoVerrs(err) - - mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813") - mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) - - suite.Equal(unit.Pound(4000), *ppmShipment.EstimatedWeight) - suite.Equal(unit.Cents(37841824), linehaul) - suite.Equal(unit.Cents(3004), fuel) - suite.Equal(unit.Cents(16160), origin) - suite.Equal(unit.Cents(33280), dest) - suite.Equal(unit.Cents(295800), packing) - suite.Equal(unit.Cents(23880), unpacking) - - total := linehaul + fuel + origin + dest + packing + unpacking - suite.Equal(unit.Cents(38213948), total) - }) - suite.Run("Estimated Incentive", func() { suite.Run("Estimated Incentive - Success", func() { oldPPMShipment := factory.BuildMinimalPPMShipment(suite.DB(), nil, nil) diff --git a/pkg/services/pptas_report.go b/pkg/services/pptas_report.go deleted file mode 100644 index d68e1ddb05d..00000000000 --- a/pkg/services/pptas_report.go +++ /dev/null @@ -1,14 +0,0 @@ -package services - -import ( - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -// PPTASReportListFetcher is the exported interface for fetching reports -// -//go:generate mockery --name PPTASReportListFetcher -type PPTASReportListFetcher interface { - GetMovesForReportBuilder(appCtx appcontext.AppContext, params *MoveTaskOrderFetcherParams) (models.Moves, error) - BuildPPTASReportsFromMoves(appCtx appcontext.AppContext, moves models.Moves) (models.PPTASReports, error) -} diff --git a/pkg/services/pptas_report/pptas_report_list_fetcher.go b/pkg/services/pptas_report/pptas_report_list_fetcher.go deleted file mode 100644 index 1afbe355ce7..00000000000 --- a/pkg/services/pptas_report/pptas_report_list_fetcher.go +++ /dev/null @@ -1,554 +0,0 @@ -package report - -import ( - "time" - - "github.com/go-openapi/strfmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/apperror" - "github.com/transcom/mymove/pkg/etag" - "github.com/transcom/mymove/pkg/gen/pptasmessages" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/services" - "github.com/transcom/mymove/pkg/unit" -) - -type pptasReportListFetcher struct { - estimator services.PPMEstimator - moveFetcher services.MoveFetcher - tacFetcher services.TransportationAccountingCodeFetcher - loaFetcher services.LineOfAccountingFetcher -} - -func NewPPTASReportListFetcher(estimator services.PPMEstimator, moveFetcher services.MoveFetcher, tacFetcher services.TransportationAccountingCodeFetcher, loaFetcher services.LineOfAccountingFetcher) services.PPTASReportListFetcher { - return &pptasReportListFetcher{ - estimator: estimator, - moveFetcher: moveFetcher, - tacFetcher: tacFetcher, - loaFetcher: loaFetcher, - } -} - -func (f *pptasReportListFetcher) GetMovesForReportBuilder(appCtx appcontext.AppContext, params *services.MoveTaskOrderFetcherParams) (models.Moves, error) { - moves, err := f.moveFetcher.FetchMovesForPPTASReports(appCtx, params) - - if err != nil { - return nil, err - } - - return moves, err -} - -// Builds a list of reports for PPTAS -func (f *pptasReportListFetcher) BuildPPTASReportsFromMoves(appCtx appcontext.AppContext, moves models.Moves) (models.PPTASReports, error) { - var fullreport models.PPTASReports - - for _, move := range moves { - var report models.PPTASReport - orders := move.Orders - var middleInitial string - if orders.ServiceMember.MiddleName != nil && *orders.ServiceMember.MiddleName != "" { - middleInitial = string([]rune(*orders.ServiceMember.MiddleName)[0]) - } - - scac := "HSFR" - transmitCd := "T" - - // handle orders and service member information here - report.FirstName = orders.ServiceMember.FirstName - report.LastName = orders.ServiceMember.LastName - report.MiddleInitial = &middleInitial - report.Affiliation = orders.ServiceMember.Affiliation - report.PayGrade = orders.Grade - report.Edipi = orders.ServiceMember.Edipi - report.PhonePrimary = orders.ServiceMember.Telephone - report.PhoneSecondary = orders.ServiceMember.SecondaryTelephone - report.EmailPrimary = orders.ServiceMember.PersonalEmail - report.OrdersType = orders.OrdersType - report.TravelClassCode = (*string)(&orders.OrdersType) - report.OrdersNumber = orders.OrdersNumber - report.OrdersDate = &orders.IssueDate - report.TAC = orders.TAC - report.ShipmentNum = len(move.MTOShipments) - report.SCAC = &scac - report.OriginGBLOC = orders.OriginDutyLocationGBLOC - report.DestinationGBLOC = &orders.NewDutyLocation.TransportationOffice.Gbloc - report.DepCD = orders.HasDependents - report.TransmitCd = &transmitCd - report.CounseledDate = move.ServiceCounselingCompletedAt - - financialFlag := move.FinancialReviewFlag - report.FinancialReviewFlag = &financialFlag - - financialRemarks := move.FinancialReviewRemarks - report.FinancialReviewRemarks = financialRemarks - - addressLoad := appCtx.DB().Load(&orders.ServiceMember, "ResidentialAddress") - if addressLoad != nil { - return nil, apperror.NewQueryError("failed to load residential address", addressLoad, ".") - } - report.Address = orders.ServiceMember.ResidentialAddress - - if orders.Grade != nil && orders.Entitlement != nil { - orders.Entitlement.SetWeightAllotment(string(*orders.Grade)) - } - - weightAllotment := orders.Entitlement.WeightAllotment() - - var totalWeight unit.Pound - if orders.Entitlement.DBAuthorizedWeight != nil && weightAllotment != nil { - if orders.Entitlement.DependentsAuthorized != nil { - totalWeight = unit.Pound(weightAllotment.TotalWeightSelfPlusDependents) - - report.WeightAuthorized = (*unit.Pound)(orders.Entitlement.DBAuthorizedWeight) - } else { - totalWeight = unit.Pound(weightAllotment.TotalWeightSelf) - - report.WeightAuthorized = (*unit.Pound)(orders.Entitlement.DBAuthorizedWeight) - } - } - - report.EntitlementWeight = &totalWeight - - if orders.ServiceMember.BackupContacts != nil { - report.EmailSecondary = &orders.ServiceMember.BackupContacts[0].Email - } - - if orders.OrdersTypeDetail != nil { - report.TravelType = (*string)(orders.OrdersTypeDetail) - } - - if orders.SAC != nil { - report.OrderNumber = orders.SAC - } - - err := populateShipmentFields(&report, appCtx, move, orders, f.tacFetcher, f.loaFetcher, f.estimator) - if err != nil { - return nil, err - } - - fullreport = append(fullreport, report) - } - - return fullreport, nil -} - -// iterate through mtoshipments and build out PPTASShipment objects for pptas report. -func populateShipmentFields( - report *models.PPTASReport, appCtx appcontext.AppContext, move models.Move, - orders models.Order, tacFetcher services.TransportationAccountingCodeFetcher, - loaFetcher services.LineOfAccountingFetcher, estimator services.PPMEstimator) error { - var pptasShipments []*pptasmessages.PPTASShipment - for _, shipment := range move.MTOShipments { - var pptasShipment pptasmessages.PPTASShipment - - pptasShipment.ShipmentID = strfmt.UUID(shipment.ID.String()) - pptasShipment.ShipmentType = string(shipment.ShipmentType) - - var moveDate *time.Time - if shipment.ActualPickupDate != nil { - moveDate = shipment.ActualPickupDate - pptasShipment.MoveDate = (*strfmt.Date)(moveDate) - } - - if moveDate != nil && shipment.ActualDeliveryDate != nil { - pptasShipment.DeliveryDate = strfmt.Date(*shipment.ActualDeliveryDate) - } - - if shipment.ActualPickupDate != nil { - pptasShipment.PickupDate = strfmt.Date(*shipment.ActualPickupDate) - } - - pptasShipment.MoveDate = (*strfmt.Date)(moveDate) - - if move.ServiceCounselingCompletedAt != nil { - pptasShipment.Dd2278IssueDate = strfmt.Date(*move.ServiceCounselingCompletedAt) - } else if move.PrimeCounselingCompletedAt != nil { - pptasShipment.Dd2278IssueDate = strfmt.Date(*move.PrimeCounselingCompletedAt) - } - - // location fields - if pptasShipment.OriginAddress == nil { - pptasShipment.OriginAddress = Address(shipment.PickupAddress) - } - if pptasShipment.DestinationAddress == nil { - pptasShipment.DestinationAddress = Address(shipment.DestinationAddress) - } - - // populate TGET data - tacErr := inputReportTAC(&pptasShipment, orders, appCtx, tacFetcher, loaFetcher) - if tacErr != nil { - return tacErr - } - - // populate payment request data - err := populatePaymentRequestFields(&pptasShipment, appCtx, shipment) - if err != nil { - return err - } - - // populate ppm data - err = populatePPMFields(appCtx, &pptasShipment, shipment, estimator) - if err != nil { - return err - } - - var originActualWeight float64 - if pptasShipment.ActualOriginNetWeight == nil && shipment.PrimeActualWeight != nil { - originActualWeight = shipment.PrimeActualWeight.Float64() - pptasShipment.ActualOriginNetWeight = &originActualWeight - } - - if shipment.Reweigh != nil { - reweigh := shipment.Reweigh.Weight.Float64() - pptasShipment.DestinationReweighNetWeight = &reweigh - } - - netWeight := models.GetTotalNetWeightForMTOShipment(shipment).Int64() - pptasShipment.NetWeight = &netWeight - - var weightEstimate float64 - if shipment.PPMShipment != nil { - weightEstimate = shipment.PPMShipment.EstimatedWeight.Float64() - } - - if shipment.PrimeEstimatedWeight != nil { - weightEstimate = shipment.PrimeEstimatedWeight.Float64() - } - pptasShipment.WeightEstimate = &weightEstimate - - if shipment.Distance != nil { - pptasShipment.Miles = int64(*shipment.Distance) - } - - pptasShipments = append(pptasShipments, &pptasShipment) - } - - report.Shipments = pptasShipments - - return nil -} - -func populatePaymentRequestFields(pptasShipment *pptasmessages.PPTASShipment, appCtx appcontext.AppContext, shipment models.MTOShipment) error { - var paymentRequests []models.PaymentRequest - prQErr := appCtx.DB().EagerPreload( - "PaymentServiceItems.MTOServiceItem.ReService"). - InnerJoin("payment_service_items", "payment_requests.id = payment_service_items.payment_request_id"). - InnerJoin("mto_service_items", "mto_service_items.id = payment_service_items.mto_service_item_id"). - Where("mto_service_items.mto_shipment_id = ?", shipment.ID). - Where("payment_requests.status = ?", models.PaymentRequestStatusReviewed). - GroupBy("payment_requests.id"). - All(&paymentRequests) - if prQErr != nil { - return apperror.NewQueryError("failed to query payment request", prQErr, ".") - } - - if len(paymentRequests) < 1 { - return nil - } - - var linehaulTotal, managementTotal, fuelPrice, domesticOriginTotal, domesticDestTotal, domesticPacking, - domesticUnpacking, domesticCrating, domesticUncrating, counselingTotal, sitPickuptotal, sitOriginFuelSurcharge, - sitOriginShuttle, sitOriginAddlDays, sitOriginFirstDay, sitDeliveryTotal, sitDestFuelSurcharge, sitDestShuttle, - sitDestAddlDays, sitDestFirstDay float64 - - var allCrates []*pptasmessages.Crate - - // assign the service item cost to the corresponding variable - for _, pr := range paymentRequests { - for _, serviceItem := range pr.PaymentServiceItems { - mtoServiceItem := serviceItem.MTOServiceItem - - err := appCtx.DB().Load(&mtoServiceItem, "Dimensions") - if err != nil { - return err - } - - var totalPrice float64 - if serviceItem.PriceCents != nil { - totalPrice = serviceItem.PriceCents.Float64() - } - - if serviceItem.MTOServiceItem.SITEntryDate != nil { - pptasShipment.SitInDate = (*strfmt.Date)(serviceItem.MTOServiceItem.SITEntryDate) - } - - if serviceItem.MTOServiceItem.SITDepartureDate != nil { - pptasShipment.SitOutDate = (*strfmt.Date)(serviceItem.MTOServiceItem.SITDepartureDate) - } - - switch serviceItem.MTOServiceItem.ReService.Name { - case "Domestic linehaul": - case "Domestic shorthaul": - linehaulTotal += totalPrice - case "Move management": - managementTotal += totalPrice - case "Fuel surcharge": - fuelPrice += totalPrice - case "Domestic origin price": - domesticOriginTotal += totalPrice - case "Domestic destination price": - domesticDestTotal += totalPrice - case "Domestic packing": - domesticPacking += totalPrice - case "Domestic unpacking": - domesticUnpacking += totalPrice - case "Domestic uncrating": - domesticUncrating += totalPrice - case "Domestic crating": - crate := buildServiceItemCrate(mtoServiceItem) - allCrates = append(allCrates, &crate) - domesticCrating += totalPrice - case "Domestic origin SIT pickup": - sitPickuptotal += totalPrice - case "Domestic origin SIT fuel surcharge": - sitOriginFuelSurcharge += totalPrice - case "Domestic origin shuttle service": - sitOriginShuttle += totalPrice - case "Domestic origin add'l SIT": - sitOriginAddlDays += totalPrice - case "Domestic origin 1st day SIT": - if pptasShipment.SitType == nil || *pptasShipment.SitType == "" { - pptasShipment.SitType = models.StringPointer("Origin") - } - sitOriginFirstDay += totalPrice - case "Domestic destination SIT fuel surcharge": - sitDestFuelSurcharge += totalPrice - case "Domestic destination SIT delivery": - sitDeliveryTotal += totalPrice - case "Domestic destination shuttle service": - sitDestShuttle += totalPrice - case "Domestic destination add'l SIT": - sitDestAddlDays += totalPrice - case "Domestic destination 1st day SIT": - if pptasShipment.SitType == models.StringPointer("Origin") || pptasShipment.SitType == nil { - sitType := "Destination" - pptasShipment.SitType = &sitType - } - sitDestFirstDay += totalPrice - case "Counseling": - counselingTotal += totalPrice - default: - continue - } - } - - // Paid date is the earliest payment request date - if pr.PaidAt != nil && pptasShipment.PaidDate == nil { - paidDate := strfmt.Date(*pr.PaidAt) - pptasShipment.PaidDate = &paidDate - } else if pr.PaidAt != nil && !pr.PaidAt.After(time.Time(*pptasShipment.PaidDate)) { - paidDate := strfmt.Date(*pr.PaidAt) - pptasShipment.PaidDate = &paidDate - } - } - - shuttleTotal := sitOriginShuttle + sitDestShuttle - pptasShipment.LinehaulTotal = &linehaulTotal - pptasShipment.LinehaulFuelTotal = &fuelPrice - pptasShipment.OriginPrice = &domesticOriginTotal - pptasShipment.DestinationPrice = &domesticDestTotal - pptasShipment.PackingPrice = &domesticPacking - pptasShipment.UnpackingPrice = &domesticUnpacking - pptasShipment.CratingTotal = &domesticCrating - pptasShipment.UncratingTotal = &domesticUncrating - pptasShipment.ShuttleTotal = &shuttleTotal - pptasShipment.MoveManagementFeeTotal = &managementTotal - pptasShipment.CounselingFeeTotal = &counselingTotal - pptasShipment.CratingDimensions = allCrates - - // calculate total invoice cost - invoicePaidAmt := shuttleTotal + linehaulTotal + fuelPrice + domesticOriginTotal + domesticDestTotal + domesticPacking + domesticUnpacking + - sitOriginFirstDay + sitOriginAddlDays + sitDestFirstDay + sitDestAddlDays + sitPickuptotal + sitDeliveryTotal + sitOriginFuelSurcharge + - sitDestFuelSurcharge + domesticCrating + domesticUncrating - pptasShipment.InvoicePaidAmt = &invoicePaidAmt - - if pptasShipment.SitInDate != nil || pptasShipment.SitOutDate != nil { - pptasShipment.SitOriginFirstDayTotal = &sitOriginFirstDay - pptasShipment.SitOriginAddlDaysTotal = &sitOriginAddlDays - pptasShipment.SitDestFirstDayTotal = &sitDestFirstDay - pptasShipment.SitDestAddlDaysTotal = &sitDestAddlDays - pptasShipment.SitPickupTotal = &sitPickuptotal - pptasShipment.SitDeliveryTotal = &sitDeliveryTotal - pptasShipment.SitOriginFuelSurcharge = &sitOriginFuelSurcharge - pptasShipment.SitDestFuelSurcharge = &sitDestFuelSurcharge - } - - return nil -} - -// populates ppm related fields (progear, ppm costs, SIT) -func populatePPMFields(appCtx appcontext.AppContext, pptasShipment *pptasmessages.PPTASShipment, shipment models.MTOShipment, estimator services.PPMEstimator) error { - var travelAdvance float64 - - var ppmLinehaul, ppmFuel, ppmOriginPrice, ppmDestPrice, ppmPacking, ppmUnpacking, ppmStorage float64 - if shipment.PPMShipment != nil && (shipment.PPMShipment.Status == models.PPMShipmentStatusCloseoutComplete || shipment.PPMShipment.Status == models.PPMShipmentStatusComplete) { - // query the ppmshipment for all it's child needs for the price breakdown - var ppmShipment models.PPMShipment - ppmQ := appCtx.DB().Q().EagerPreload("PickupAddress", "DestinationAddress", "WeightTickets", "Shipment"). - InnerJoin("mto_shipments", "mto_shipments.id = ppm_shipments.shipment_id"). - Where("ppm_shipments.id = ?", shipment.PPMShipment.ID). - Where("ppm_shipments.status = ?", models.PPMShipmentStatusCloseoutComplete). - First(&ppmShipment) - - // if the ppm isn't in closeout complete status skip to the next shipment - if ppmQ != nil && ppmQ.Error() == models.RecordNotFoundErrorString { - return ppmQ - } - - if ppmQ != nil { - return apperror.NewQueryError("failed to query ppm ", ppmQ, ".") - } - - if pptasShipment.OriginAddress == nil { - pptasShipment.OriginAddress = Address(ppmShipment.PickupAddress) - } - if pptasShipment.DestinationAddress == nil { - pptasShipment.DestinationAddress = Address(ppmShipment.DestinationAddress) - } - - moveDate := &shipment.PPMShipment.ExpectedDepartureDate - pptasShipment.MoveDate = (*strfmt.Date)(moveDate) - - pptasShipment.DeliveryDate = strfmt.Date(*ppmShipment.ActualMoveDate) - - ppmNetWeight := calculatePPMNetWeight(ppmShipment) - pptasShipment.ActualOriginNetWeight = models.Float64Pointer(ppmNetWeight) - - var shipmentTotalProgear float64 - if ppmShipment.ProGearWeight != nil { - shipmentTotalProgear += ppmShipment.ProGearWeight.Float64() - } - - if ppmShipment.SpouseProGearWeight != nil { - shipmentTotalProgear += ppmShipment.SpouseProGearWeight.Float64() - } - - pptasShipment.PbpAnde = &shipmentTotalProgear - - // need to determine which shipment(s) have a ppm and get the travel advances and add them up - if ppmShipment.AdvanceAmountReceived != nil { - travelAdvance = ppmShipment.AdvanceAmountReceived.Float64() - pptasShipment.TravelAdvance = &travelAdvance - } - - // add SIT fields - if ppmShipment.SITExpected != nil && *ppmShipment.SITExpected { - pptasShipment.SitInDate = (*strfmt.Date)(ppmShipment.SITEstimatedEntryDate) - pptasShipment.SitOutDate = (*strfmt.Date)(ppmShipment.SITEstimatedDepartureDate) - } - - // do the ppm cost breakdown here - linehaul, fuel, origin, dest, packing, unpacking, storage, err := estimator.PriceBreakdown(appCtx, &ppmShipment) - if err != nil { - return apperror.NewUnprocessableEntityError("ppm price breakdown") - } - - ppmLinehaul += linehaul.Float64() - ppmFuel += fuel.Float64() - ppmOriginPrice += origin.Float64() - ppmDestPrice += dest.Float64() - ppmPacking += packing.Float64() - ppmUnpacking += unpacking.Float64() - ppmStorage += storage.Float64() - ppmTotal := ppmLinehaul + ppmFuel + ppmOriginPrice + ppmDestPrice + ppmPacking + ppmUnpacking + ppmStorage - - pptasShipment.PpmLinehaul = &ppmLinehaul - pptasShipment.PpmFuelRateAdjTotal = &ppmFuel - pptasShipment.PpmOriginPrice = &ppmOriginPrice - pptasShipment.PpmDestPrice = &ppmDestPrice - pptasShipment.PpmPacking = &ppmPacking - pptasShipment.PpmUnpacking = &ppmUnpacking - pptasShipment.PpmStorage = &ppmStorage - pptasShipment.PpmTotal = &ppmTotal - } - - return nil -} - -// calculate the ppm net weight by taking the difference in full weight and empty weight in the weight tickets -func calculatePPMNetWeight(ppmShipment models.PPMShipment) float64 { - totalNetWeight := unit.Pound(0) - - for _, weightTicket := range ppmShipment.WeightTickets { - totalNetWeight += *weightTicket.FullWeight - *weightTicket.EmptyWeight - } - - return totalNetWeight.Float64() -} - -func buildServiceItemCrate(serviceItem models.MTOServiceItem) pptasmessages.Crate { - var newServiceItemCrate pptasmessages.Crate - var newCrateDimensions pptasmessages.MTOServiceItemDimension - var newItemDimensions pptasmessages.MTOServiceItemDimension - - for dimensionIndex := range serviceItem.Dimensions { - if serviceItem.Dimensions[dimensionIndex].Type == "ITEM" { - newItemDimensions.Type = pptasmessages.DimensionTypeITEM - newItemDimensions.Height = int32(serviceItem.Dimensions[dimensionIndex].Height) - newItemDimensions.Length = int32(serviceItem.Dimensions[dimensionIndex].Length) - newItemDimensions.Width = int32(serviceItem.Dimensions[dimensionIndex].Width) - newServiceItemCrate.ItemDimensions = &newItemDimensions - } - if serviceItem.Dimensions[dimensionIndex].Type == "CRATE" { - newCrateDimensions.Type = pptasmessages.DimensionTypeCRATE - newCrateDimensions.Height = int32(serviceItem.Dimensions[dimensionIndex].Height) - newCrateDimensions.Length = int32(serviceItem.Dimensions[dimensionIndex].Length) - newCrateDimensions.Width = int32(serviceItem.Dimensions[dimensionIndex].Width) - newServiceItemCrate.CrateDimensions = &newCrateDimensions - } - } - - newServiceItemCrate.Description = *serviceItem.Description - - return newServiceItemCrate -} - -// inputs all TAC related fields and builds full line of accounting string -func inputReportTAC(pptasShipment *pptasmessages.PPTASShipment, orders models.Order, appCtx appcontext.AppContext, tacFetcher services.TransportationAccountingCodeFetcher, loa services.LineOfAccountingFetcher) error { - tac, err := tacFetcher.FetchOrderTransportationAccountingCodes(*orders.ServiceMember.Affiliation, orders.IssueDate, *orders.TAC, appCtx) - if err != nil { - return err - } else if len(tac) < 1 { - return nil - } - - if tac[0].LineOfAccounting != nil { - longLoa := loa.BuildFullLineOfAccountingString(*tac[0].LineOfAccounting) - - pptasShipment.Loa = &longLoa - pptasShipment.FiscalYear = tac[0].TacFyTxt - pptasShipment.Appro = tac[0].LineOfAccounting.LoaBafID - pptasShipment.Subhead = tac[0].LineOfAccounting.LoaObjClsID - pptasShipment.ObjClass = tac[0].LineOfAccounting.LoaAlltSnID - pptasShipment.Bcn = tac[0].LineOfAccounting.LoaSbaltmtRcpntID - pptasShipment.SubAllotCD = tac[0].LineOfAccounting.LoaInstlAcntgActID - pptasShipment.Aaa = tac[0].LineOfAccounting.LoaTrnsnID - pptasShipment.TypeCD = tac[0].LineOfAccounting.LoaJbOrdNm - pptasShipment.Paa = tac[0].LineOfAccounting.LoaDocID - pptasShipment.CostCD = tac[0].LineOfAccounting.LoaPgmElmntID - pptasShipment.Ddcd = tac[0].LineOfAccounting.LoaDptID - } - - return nil -} - -// converts models.Address into payload address -func Address(address *models.Address) *pptasmessages.Address { - if address == nil { - return nil - } - return &pptasmessages.Address{ - ID: strfmt.UUID(address.ID.String()), - StreetAddress1: &address.StreetAddress1, - StreetAddress2: address.StreetAddress2, - StreetAddress3: address.StreetAddress3, - City: &address.City, - State: &address.State, - PostalCode: &address.PostalCode, - Country: address.Country, - County: &address.County, - ETag: etag.GenerateEtag(address.UpdatedAt), - } -} diff --git a/pkg/services/pptas_report/pptas_report_list_fetcher_test.go b/pkg/services/pptas_report/pptas_report_list_fetcher_test.go deleted file mode 100644 index 49748c7bc0d..00000000000 --- a/pkg/services/pptas_report/pptas_report_list_fetcher_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package report - -import ( - "time" - - "github.com/stretchr/testify/mock" - - "github.com/transcom/mymove/pkg/factory" - "github.com/transcom/mymove/pkg/gen/internalmessages" - "github.com/transcom/mymove/pkg/models" - mocks "github.com/transcom/mymove/pkg/services/mocks" -) - -func (suite *ReportServiceSuite) TestReportFetcher() { - ppmEstimator := mocks.PPMEstimator{} - moveFetcher := mocks.MoveFetcher{} - tacFetcher := mocks.TransportationAccountingCodeFetcher{} - loaFetcher := mocks.LineOfAccountingFetcher{} - - reportListFetcher := NewPPTASReportListFetcher(&ppmEstimator, &moveFetcher, &tacFetcher, &loaFetcher) - // defaultSearchParams := services.MoveTaskOrderFetcherParams{} - - appCtx := suite.AppContextForTest() - - // Setup data - testDate := time.Now() - serviceMember := factory.BuildServiceMember(suite.DB(), []factory.Customization{ - { - Model: models.ServiceMember{ - MiddleName: models.StringPointer("O"), - Affiliation: (*models.ServiceMemberAffiliation)(internalmessages.AffiliationNAVY.Pointer()), - }, - }, - }, nil) - orders := factory.BuildOrder(suite.DB(), []factory.Customization{ - { - Model: serviceMember, - LinkOnly: true, - }, - { - Model: models.Order{ - TAC: models.StringPointer("E12A"), - IssueDate: testDate, - }, - }, - }, nil) - move := factory.BuildMoveWithShipment(suite.DB(), []factory.Customization{ - { - Model: orders, - LinkOnly: true, - }, - { - Model: models.Move{ - ServiceCounselingCompletedAt: &testDate, - }, - }, - { - Model: models.MTOShipment{ - Status: models.MTOShipmentStatusApproved, - }, - }, - }, nil) - - pr := factory.BuildPaymentRequest(suite.DB(), []factory.Customization{ - { - Model: models.PaymentRequest{ - Status: models.PaymentRequestStatusReviewed, - MoveTaskOrderID: move.ID, - }, - }, - }, nil) - - factory.BuildPaymentServiceItem(suite.DB(), []factory.Customization{ - { - Model: models.PaymentServiceItem{ - PaymentRequestID: pr.ID, - }, - }, - }, nil) - - beginDate := time.Now().AddDate(0, 0, -10) - endDate := time.Now().AddDate(0, 0, 10) - hsgdscd := models.LineOfAccountingHouseholdGoodsCodeEnlisted - loa := factory.BuildFullLineOfAccounting(nil, []factory.Customization{ - { - Model: models.LineOfAccounting{ - LoaSysID: models.StringPointer("ooga booga"), - LoaInstlAcntgActID: models.StringPointer("123"), - LoaBgnDt: &beginDate, - LoaEndDt: &endDate, - LoaHsGdsCd: &hsgdscd, - }, - }, - }, nil) - tac := factory.BuildTransportationAccountingCode(suite.DB(), []factory.Customization{ - { - Model: models.TransportationAccountingCode{ - TAC: "E12A", - TacFnBlModCd: models.StringPointer("W"), - LoaSysID: loa.LoaSysID, - TrnsprtnAcntBgnDt: &beginDate, - TrnsprtnAcntEndDt: &endDate, - }, - }, - { - Model: loa, - LinkOnly: false, - }, - }, nil) - - var movesForReport models.Moves - movesForReport = append(movesForReport, move) - - suite.Run("successfully create a report", func() { - tacFetcher.On("FetchOrderTransportationAccountingCodes", - mock.Anything, - mock.Anything, - "E12A", - mock.AnythingOfType("*appcontext.appContext"), - ).Return(nil, nil) - - reports, err := reportListFetcher.BuildPPTASReportsFromMoves(appCtx, movesForReport) - suite.NoError(err) - - suite.Equal(1, len(reports)) - suite.Equal(tac.TAC, *reports[0].TAC) - }) -} diff --git a/pkg/services/pptas_report/pptas_report_service_test.go b/pkg/services/pptas_report/pptas_report_service_test.go deleted file mode 100644 index 11a857a646e..00000000000 --- a/pkg/services/pptas_report/pptas_report_service_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package report - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "github.com/transcom/mymove/pkg/testingsuite" -) - -type ReportServiceSuite struct { - *testingsuite.PopTestSuite -} - -func TestReportServiceSuite(t *testing.T) { - ts := &ReportServiceSuite{ - PopTestSuite: testingsuite.NewPopTestSuite(testingsuite.CurrentPackage(), - testingsuite.WithPerTestTransaction()), - } - suite.Run(t, ts) - ts.PopTestSuite.TearDown() -} diff --git a/swagger-def/definitions/Crate.yaml b/swagger-def/definitions/Crate.yaml deleted file mode 100644 index 93487ff34e4..00000000000 --- a/swagger-def/definitions/Crate.yaml +++ /dev/null @@ -1,10 +0,0 @@ -description: Crate object for PPTAS Reports -type: object -properties: - itemDimensions: - $ref: 'MTOServiceItemDimension.yaml' - crateDimensions: - $ref: 'MTOServiceItemDimension.yaml' - description: - type: string -x-nullable: true \ No newline at end of file diff --git a/swagger-def/definitions/ListMove.yaml b/swagger-def/definitions/ListMove.yaml new file mode 100644 index 00000000000..0c26418a1d0 --- /dev/null +++ b/swagger-def/definitions/ListMove.yaml @@ -0,0 +1,41 @@ +description: > + An abbreviated definition for a move, without all the nested information (shipments, service items, etc). Used to + fetch a list of moves more efficiently. +type: object +properties: + id: + example: 1f2270c7-7166-40ae-981e-b200ebdf3054 + format: uuid + type: string + moveCode: + type: string + example: 'HYXFJF' + readOnly: true + createdAt: + format: date-time + type: string + readOnly: true + orderID: + example: c56a4180-65aa-42ec-a945-5fd21dec0538 + format: uuid + type: string + referenceId: + example: 1001-3456 + type: string + availableToPrimeAt: + format: date-time + type: string + x-nullable: true + readOnly: true + updatedAt: + format: date-time + type: string + readOnly: true + ppmType: + type: string + enum: + - FULL + - PARTIAL + eTag: + type: string + readOnly: true diff --git a/swagger-def/definitions/ListMoves.yaml b/swagger-def/definitions/ListMoves.yaml new file mode 100644 index 00000000000..dd446f1e853 --- /dev/null +++ b/swagger-def/definitions/ListMoves.yaml @@ -0,0 +1,3 @@ +type: array +items: + $ref: '../definitions/ListMove.yaml' diff --git a/swagger-def/definitions/PPTASReport.yaml b/swagger-def/definitions/PPTASReport.yaml deleted file mode 100644 index 89181be9d3a..00000000000 --- a/swagger-def/definitions/PPTASReport.yaml +++ /dev/null @@ -1,162 +0,0 @@ -description: > - Report for Navy PPTAS, contains information about Service Members, Orders, Move Task Orders, Shipments, - and Payment Requests. -type: object -properties: - firstName: - example: Bob - type: string - lastName: - example: Job - type: string - middleInitial: - example: G - type: string - x-nullable: true - affiliation: - $ref: 'Affiliation.yaml' - payGrade: - type: string - x-nullable: true - title: grade - enum: - - E_1 - - E_2 - - E_3 - - E_4 - - E_5 - - E_6 - - E_7 - - E_8 - - E_9 - - E_9_SPECIAL_SENIOR_ENLISTED - - O_1_ACADEMY_GRADUATE - - O_2 - - O_3 - - O_4 - - O_5 - - O_6 - - O_7 - - O_8 - - O_9 - - O_10 - - W_1 - - W_2 - - W_3 - - W_4 - - W_5 - - AVIATION_CADET - - CIVILIAN_EMPLOYEE - - ACADEMY_CADET - - MIDSHIPMAN - x-display-value: - E_1: E-1 - E_2: E-2 - E_3: E-3 - E_4: E-4 - E_5: E-5 - E_6: E-6 - E_7: E-7 - E_8: E-8 - E_9: E-9 - E_9_SPECIAL_SENIOR_ENLISTED: E-9 (Special Senior Enlisted) - O_1_ACADEMY_GRADUATE: O-1 or Service Academy Graduate - O_2: O-2 - O_3: O-3 - O_4: O-4 - O_5: O-5 - O_6: O-6 - O_7: O-7 - O_8: O-8 - O_9: O-9 - O_10: O-10 - W_1: W-1 - W_2: W-2 - W_3: W-3 - W_4: W-4 - W_5: W-5 - AVIATION_CADET: Aviation Cadet - CIVILIAN_EMPLOYEE: Civilian Employee - ACADEMY_CADET: Service Academy Cadet - MIDSHIPMAN: Midshipman - edipi: - type: string - phonePrimary: - type: string - phoneSecondary: - type: string - x-nullable: true - emailPrimary: - example: a@b.com - type: string - emailSecondary: - type: string - x-nullable: true - address: - $ref: 'Address.yaml' - ordersType: - type: string - ordersNumber: - type: string - ordersDate: - type: string - format: date-time - originGbloc: - type: string - pattern: '^[A-Z]{4}$' - x-nullable: true - destinationGbloc: - type: string - pattern: '^[A-Z]{4}$' - x-nullable: true - scac: - example: AGFM - type: string - x-nullable: true - transmitCD: - description: Transmit Code - type: string - x-nullable: true - tac: - description: Transportation Accounting Code - type: string - x-nullable: true - shipmentNum: - description: Number of shipments - type: integer - depCD: - description: Dependent Code - type: boolean - x-nullable: true - weightAuthorized: - type: number - format: double - x-nullable: true - entitlementWeight: - type: integer - x-nullable: true - counseledDate: - type: string - format: date - orderNumber: - description: not to be confused with Orders Number - type: string - example: '030-00362' - x-nullable: true - travelType: - description: Travel Type - example: Shipment of HHG Permitted - type: string - travelClassCode: - example: PCS - type: string - financialReviewFlag: - type: boolean - x-nullable: true - financialReviewRemarks: - type: string - x-nullable: true - shipments: - type: array - items: - $ref: 'PPTASShipment.yaml' \ No newline at end of file diff --git a/swagger-def/definitions/PPTASReports.yaml b/swagger-def/definitions/PPTASReports.yaml deleted file mode 100644 index 5bbb4371985..00000000000 --- a/swagger-def/definitions/PPTASReports.yaml +++ /dev/null @@ -1,3 +0,0 @@ -type: array -items: - $ref: 'PPTASReport.yaml' \ No newline at end of file diff --git a/swagger-def/definitions/PPTASShipment.yaml b/swagger-def/definitions/PPTASShipment.yaml deleted file mode 100644 index 97b03ddc808..00000000000 --- a/swagger-def/definitions/PPTASShipment.yaml +++ /dev/null @@ -1,246 +0,0 @@ -description: > - Shipment definition used for PPTAS reports. -properties: - originAddress: - $ref: 'Address.yaml' - destinationAddress: - $ref: 'Address.yaml' - travelAdvance: - type: number - format: double - x-nullable: true - moveDate: - type: string - format: date - x-nullable: true - fiscalYear: - type: string - x-nullable: true - appro: - description: Appropriation - type: string - x-nullable: true - subhead: - description: LoaObjClsID in lines_of_accounting - type: string - x-nullable: true - objClass: - description: LoaAlltSnID in lines_of_accounting - type: string - x-nullable: true - bcn: - description: LoaSbaltmtRcpntID in lines_of_accounting - type: string - x-nullable: true - subAllotCD: - description: LoaInstlAcntgActID in lines_of_accounting - type: string - x-nullable: true - aaa: - description: LoaTrnsnID in lines_of_accounting - type: string - x-nullable: true - typeCD: - description: LoaJbOrdNm in lines_of_accounting - type: string - x-nullable: true - paa: - description: LoaDocID in lines_of_accounting - type: string - x-nullable: true - costCD: - description: LoaPgmElmntID in lines_of_accounting - type: string - x-nullable: true - ddcd: - description: LoaDptID in lines_of_accounting - type: string - x-nullable: true - weightEstimate: - description: Total weight estimate - type: number - format: double - x-nullable: true - dd2278IssueDate: - description: Counseling Date - type: string - format: date - miles: - type: integer - shipmentId: - type: string - format: uuid - loa: - description: Line of Accounting - type: string - x-nullable: true - shipmentType: - type: string - netWeight: - type: integer - x-nullable: true - pbpAnde: - description: Pro Gear - type: number - format: double - x-nullable: true - pickupDate: - type: string - format: date - sitInDate: - description: Storage in Transit In Date - type: string - format: date - x-nullable: true - sitOutDate: - description: Storage in Transit Out Date - type: string - format: date - x-nullable: true - sitType: - description: Storage in Transit type - example: Destination - type: string - x-nullable: true - paidDate: - type: string - format: date - x-nullable: true - linehaulTotal: - type: number - format: double - x-nullable: true - linehaulFuelTotal: - type: number - format: double - x-nullable: true - originPrice: - type: number - format: double - x-nullable: true - destinationPrice: - type: number - format: double - x-nullable: true - packingPrice: - type: number - format: double - x-nullable: true - unpackingPrice: - type: number - format: double - x-nullable: true - sitOriginFirstDayTotal: - description: First day of Origin Storage in Transit cost - type: number - format: double - x-nullable: true - sitOriginAddlDaysTotal: - description: Additional day of Origin Storage in Transit cost - type: number - format: double - x-nullable: true - sitDestFirstDayTotal: - description: First day of Destination Storage in Transit cost - type: number - format: double - x-nullable: true - sitDestAddlDaysTotal: - description: Additional day of Destination Storage in Transit cost - type: number - format: double - x-nullable: true - sitPickupTotal: - description: Storage in Transit pickup total cost - type: number - format: double - x-nullable: true - sitDeliveryTotal: - description: Storage in Transit delivery total cost - type: number - format: double - x-nullable: true - sitOriginFuelSurcharge: - description: Storage in Transit origin fuel total cost - type: number - format: double - x-nullable: true - sitDestFuelSurcharge: - description: Storage in Transit destination total cost - type: number - format: double - x-nullable: true - cratingTotal: - type: number - format: double - x-nullable: true - uncratingTotal: - type: number - format: double - x-nullable: true - cratingDimensions: - type: array - items: - $ref: 'Crate.yaml' - shuttleTotal: - type: number - format: double - x-nullable: true - moveManagementFeeTotal: - type: number - format: double - x-nullable: true - counselingFeeTotal: - type: number - format: double - x-nullable: true - invoicePaidAmt: - description: Invoice Paid Amounts - type: number - format: double - x-nullable: true - ppmLinehaul: - description: Personally Procured Move Linehaul total cost - type: number - format: double - x-nullable: true - ppmFuelRateAdjTotal: - description: Personally Procured Move Fuel Rate Adjusted total cost - type: number - format: double - x-nullable: true - ppmOriginPrice: - type: number - format: double - x-nullable: true - ppmDestPrice: - type: number - format: double - x-nullable: true - ppmPacking: - type: number - format: double - x-nullable: true - ppmUnpacking: - type: number - format: double - x-nullable: true - ppmStorage: - type: number - format: double - x-nullable: true - ppmTotal: - type: number - format: double - x-nullable: true - deliveryDate: - type: string - format: date - actualOriginNetWeight: - type: number - format: double - x-nullable: true - destinationReweighNetWeight: - type: number - format: double - x-nullable: true \ No newline at end of file diff --git a/swagger-def/pptas.yaml b/swagger-def/pptas.yaml index 89f5399c9ff..9323a4f8287 100644 --- a/swagger-def/pptas.yaml +++ b/swagger-def/pptas.yaml @@ -22,10 +22,16 @@ tags: paths: /moves: get: - summary: PPTASReports + summary: listMoves description: | - Gets all reports that have been approved. Based on payment requests, includes data from Move, Shipments, Orders, and Transportation Accounting Codes and Lines of Accounting. - operationId: pptasReports + Gets all moves that have been reviewed and approved by the TOO. The `since` parameter can be used to filter this + list down to only the moves that have been updated since the provided timestamp. A move will be considered + updated if the `updatedAt` timestamp on the move or on its orders, shipments, service items, or payment + requests, is later than the provided date and time. + + **WIP**: Include what causes moves to leave this list. Currently, once the `availableToPrimeAt` timestamp has + been set, that move will always appear in this list. + operationId: listMoves tags: - moves produces: @@ -38,9 +44,9 @@ paths: description: Only return moves updated since this time. Formatted like "2021-07-23T18:30:47.116Z" responses: '200': - description: Successfully retrieved pptas reports. A successful fetch might still return zero pptas reports. + description: Successfully retrieved moves. A successful fetch might still return zero moves. schema: - $ref: 'definitions/PPTASReports.yaml' + $ref: 'definitions/ListMoves.yaml' '401': $ref: 'responses/PermissionDenied.yaml' '403': diff --git a/swagger/pptas.yaml b/swagger/pptas.yaml index 0b122990589..f59b61ccd34 100644 --- a/swagger/pptas.yaml +++ b/swagger/pptas.yaml @@ -28,12 +28,25 @@ tags: paths: /moves: get: - summary: PPTASReports + summary: listMoves description: > - Gets all reports that have been approved. Based on payment requests, - includes data from Move, Shipments, Orders, and Transportation - Accounting Codes and Lines of Accounting. - operationId: pptasReports + Gets all moves that have been reviewed and approved by the TOO. The + `since` parameter can be used to filter this + + list down to only the moves that have been updated since the provided + timestamp. A move will be considered + + updated if the `updatedAt` timestamp on the move or on its orders, + shipments, service items, or payment + + requests, is later than the provided date and time. + + + **WIP**: Include what causes moves to leave this list. Currently, once + the `availableToPrimeAt` timestamp has + + been set, that move will always appear in this list. + operationId: listMoves tags: - moves produces: @@ -49,10 +62,10 @@ paths: responses: '200': description: >- - Successfully retrieved pptas reports. A successful fetch might still - return zero pptas reports. + Successfully retrieved moves. A successful fetch might still return + zero moves. schema: - $ref: '#/definitions/PPTASReports' + $ref: '#/definitions/ListMoves' '401': $ref: '#/responses/PermissionDenied' '403': @@ -60,643 +73,53 @@ paths: '500': $ref: '#/responses/ServerError' definitions: - Affiliation: - type: string - x-nullable: true - title: Branch of service - description: Military branch of service - enum: - - ARMY - - NAVY - - MARINES - - AIR_FORCE - - COAST_GUARD - - SPACE_FORCE - - NAVY_AND_MARINES - - AIR_AND_SPACE_FORCE - - OTHER - x-display-value: - ARMY: Army - NAVY: Navy - MARINES: Marine Corps - AIR_FORCE: Air Force - COAST_GUARD: Coast Guard - SPACE_FORCE: Space Force - OTHER: OTHER - Address: - description: A postal address - type: object - properties: - id: - type: string - format: uuid - example: c56a4180-65aa-42ec-a945-5fd21dec0538 - streetAddress1: - type: string - example: 123 Main Ave - title: Street address 1 - streetAddress2: - type: string - example: Apartment 9000 - x-nullable: true - title: Street address 2 - streetAddress3: - type: string - example: Montmârtre - x-nullable: true - title: Address Line 3 - city: - type: string - example: Anytown - title: City - eTag: - type: string - readOnly: true - state: - title: State - type: string - x-display-value: - AL: AL - AK: AK - AR: AR - AZ: AZ - CA: CA - CO: CO - CT: CT - DC: DC - DE: DE - FL: FL - GA: GA - HI: HI - IA: IA - ID: ID - IL: IL - IN: IN - KS: KS - KY: KY - LA: LA - MA: MA - MD: MD - ME: ME - MI: MI - MN: MN - MO: MO - MS: MS - MT: MT - NC: NC - ND: ND - NE: NE - NH: NH - NJ: NJ - NM: NM - NV: NV - NY: NY - OH: OH - OK: OK - OR: OR - PA: PA - RI: RI - SC: SC - SD: SD - TN: TN - TX: TX - UT: UT - VA: VA - VT: VT - WA: WA - WI: WI - WV: WV - WY: WY - enum: - - AL - - AK - - AR - - AZ - - CA - - CO - - CT - - DC - - DE - - FL - - GA - - HI - - IA - - ID - - IL - - IN - - KS - - KY - - LA - - MA - - MD - - ME - - MI - - MN - - MO - - MS - - MT - - NC - - ND - - NE - - NH - - NJ - - NM - - NV - - NY - - OH - - OK - - OR - - PA - - RI - - SC - - SD - - TN - - TX - - UT - - VA - - VT - - WA - - WI - - WV - - WY - postalCode: - type: string - format: zip - title: ZIP - example: '90210' - pattern: ^(\d{5}([\-]\d{4})?)$ - country: - type: string - title: Country - x-nullable: true - example: USA - default: USA - county: - type: string - title: County - x-nullable: true - example: LOS ANGELES - required: - - streetAddress1 - - city - - state - - postalCode - DimensionType: - description: Describes a dimension type for a MTOServiceItemDimension. - type: string - enum: - - ITEM - - CRATE - MTOServiceItemDimension: - description: Describes a dimension object for the MTOServiceItem. + ListMove: + description: > + An abbreviated definition for a move, without all the nested information + (shipments, service items, etc). Used to fetch a list of moves more + efficiently. type: object properties: id: example: 1f2270c7-7166-40ae-981e-b200ebdf3054 format: uuid type: string - type: - $ref: '#/definitions/DimensionType' - length: - description: Length in thousandth inches. 1000 thou = 1 inch. - example: 1000 - type: integer - format: int32 - width: - description: Width in thousandth inches. 1000 thou = 1 inch. - example: 1000 - type: integer - format: int32 - height: - description: Height in thousandth inches. 1000 thou = 1 inch. - example: 1000 - type: integer - format: int32 - Crate: - description: Crate object for PPTAS Reports - type: object - properties: - itemDimensions: - $ref: '#/definitions/MTOServiceItemDimension' - crateDimensions: - $ref: '#/definitions/MTOServiceItemDimension' - description: + moveCode: type: string - x-nullable: true - PPTASShipment: - description: | - Shipment definition used for PPTAS reports. - properties: - originAddress: - $ref: '#/definitions/Address' - destinationAddress: - $ref: '#/definitions/Address' - travelAdvance: - type: number - format: double - x-nullable: true - moveDate: - type: string - format: date - x-nullable: true - fiscalYear: - type: string - x-nullable: true - appro: - description: Appropriation - type: string - x-nullable: true - subhead: - description: LoaObjClsID in lines_of_accounting - type: string - x-nullable: true - objClass: - description: LoaAlltSnID in lines_of_accounting - type: string - x-nullable: true - bcn: - description: LoaSbaltmtRcpntID in lines_of_accounting - type: string - x-nullable: true - subAllotCD: - description: LoaInstlAcntgActID in lines_of_accounting - type: string - x-nullable: true - aaa: - description: LoaTrnsnID in lines_of_accounting - type: string - x-nullable: true - typeCD: - description: LoaJbOrdNm in lines_of_accounting - type: string - x-nullable: true - paa: - description: LoaDocID in lines_of_accounting - type: string - x-nullable: true - costCD: - description: LoaPgmElmntID in lines_of_accounting - type: string - x-nullable: true - ddcd: - description: LoaDptID in lines_of_accounting - type: string - x-nullable: true - weightEstimate: - description: Total weight estimate - type: number - format: double - x-nullable: true - dd2278IssueDate: - description: Counseling Date - type: string - format: date - miles: - type: integer - shipmentId: + example: HYXFJF + readOnly: true + createdAt: + format: date-time type: string + readOnly: true + orderID: + example: c56a4180-65aa-42ec-a945-5fd21dec0538 format: uuid - loa: - description: Line of Accounting - type: string - x-nullable: true - shipmentType: type: string - netWeight: - type: integer - x-nullable: true - pbpAnde: - description: Pro Gear - type: number - format: double - x-nullable: true - pickupDate: - type: string - format: date - sitInDate: - description: Storage in Transit In Date - type: string - format: date - x-nullable: true - sitOutDate: - description: Storage in Transit Out Date - type: string - format: date - x-nullable: true - sitType: - description: Storage in Transit type - example: Destination - type: string - x-nullable: true - paidDate: - type: string - format: date - x-nullable: true - linehaulTotal: - type: number - format: double - x-nullable: true - linehaulFuelTotal: - type: number - format: double - x-nullable: true - originPrice: - type: number - format: double - x-nullable: true - destinationPrice: - type: number - format: double - x-nullable: true - packingPrice: - type: number - format: double - x-nullable: true - unpackingPrice: - type: number - format: double - x-nullable: true - sitOriginFirstDayTotal: - description: First day of Origin Storage in Transit cost - type: number - format: double - x-nullable: true - sitOriginAddlDaysTotal: - description: Additional day of Origin Storage in Transit cost - type: number - format: double - x-nullable: true - sitDestFirstDayTotal: - description: First day of Destination Storage in Transit cost - type: number - format: double - x-nullable: true - sitDestAddlDaysTotal: - description: Additional day of Destination Storage in Transit cost - type: number - format: double - x-nullable: true - sitPickupTotal: - description: Storage in Transit pickup total cost - type: number - format: double - x-nullable: true - sitDeliveryTotal: - description: Storage in Transit delivery total cost - type: number - format: double - x-nullable: true - sitOriginFuelSurcharge: - description: Storage in Transit origin fuel total cost - type: number - format: double - x-nullable: true - sitDestFuelSurcharge: - description: Storage in Transit destination total cost - type: number - format: double - x-nullable: true - cratingTotal: - type: number - format: double - x-nullable: true - uncratingTotal: - type: number - format: double - x-nullable: true - cratingDimensions: - type: array - items: - $ref: '#/definitions/Crate' - shuttleTotal: - type: number - format: double - x-nullable: true - moveManagementFeeTotal: - type: number - format: double - x-nullable: true - counselingFeeTotal: - type: number - format: double - x-nullable: true - invoicePaidAmt: - description: Invoice Paid Amounts - type: number - format: double - x-nullable: true - ppmLinehaul: - description: Personally Procured Move Linehaul total cost - type: number - format: double - x-nullable: true - ppmFuelRateAdjTotal: - description: Personally Procured Move Fuel Rate Adjusted total cost - type: number - format: double - x-nullable: true - ppmOriginPrice: - type: number - format: double - x-nullable: true - ppmDestPrice: - type: number - format: double - x-nullable: true - ppmPacking: - type: number - format: double - x-nullable: true - ppmUnpacking: - type: number - format: double - x-nullable: true - ppmStorage: - type: number - format: double - x-nullable: true - ppmTotal: - type: number - format: double - x-nullable: true - deliveryDate: - type: string - format: date - actualOriginNetWeight: - type: number - format: double - x-nullable: true - destinationReweighNetWeight: - type: number - format: double - x-nullable: true - PPTASReport: - description: > - Report for Navy PPTAS, contains information about Service Members, Orders, - Move Task Orders, Shipments, and Payment Requests. - type: object - properties: - firstName: - example: Bob - type: string - lastName: - example: Job - type: string - middleInitial: - example: G - type: string - x-nullable: true - affiliation: - $ref: '#/definitions/Affiliation' - payGrade: - type: string - x-nullable: true - title: grade - enum: - - E_1 - - E_2 - - E_3 - - E_4 - - E_5 - - E_6 - - E_7 - - E_8 - - E_9 - - E_9_SPECIAL_SENIOR_ENLISTED - - O_1_ACADEMY_GRADUATE - - O_2 - - O_3 - - O_4 - - O_5 - - O_6 - - O_7 - - O_8 - - O_9 - - O_10 - - W_1 - - W_2 - - W_3 - - W_4 - - W_5 - - AVIATION_CADET - - CIVILIAN_EMPLOYEE - - ACADEMY_CADET - - MIDSHIPMAN - x-display-value: - E_1: E-1 - E_2: E-2 - E_3: E-3 - E_4: E-4 - E_5: E-5 - E_6: E-6 - E_7: E-7 - E_8: E-8 - E_9: E-9 - E_9_SPECIAL_SENIOR_ENLISTED: E-9 (Special Senior Enlisted) - O_1_ACADEMY_GRADUATE: O-1 or Service Academy Graduate - O_2: O-2 - O_3: O-3 - O_4: O-4 - O_5: O-5 - O_6: O-6 - O_7: O-7 - O_8: O-8 - O_9: O-9 - O_10: O-10 - W_1: W-1 - W_2: W-2 - W_3: W-3 - W_4: W-4 - W_5: W-5 - AVIATION_CADET: Aviation Cadet - CIVILIAN_EMPLOYEE: Civilian Employee - ACADEMY_CADET: Service Academy Cadet - MIDSHIPMAN: Midshipman - edipi: - type: string - phonePrimary: - type: string - phoneSecondary: - type: string - x-nullable: true - emailPrimary: - example: a@b.com - type: string - emailSecondary: - type: string - x-nullable: true - address: - $ref: '#/definitions/Address' - ordersType: - type: string - ordersNumber: - type: string - ordersDate: + referenceId: + example: 1001-3456 type: string + availableToPrimeAt: format: date-time - originGbloc: - type: string - pattern: ^[A-Z]{4}$ - x-nullable: true - destinationGbloc: - type: string - pattern: ^[A-Z]{4}$ - x-nullable: true - scac: - example: AGFM type: string x-nullable: true - transmitCD: - description: Transmit Code - type: string - x-nullable: true - tac: - description: Transportation Accounting Code - type: string - x-nullable: true - shipmentNum: - description: Number of shipments - type: integer - depCD: - description: Dependent Code - type: boolean - x-nullable: true - weightAuthorized: - type: number - format: double - x-nullable: true - entitlementWeight: - type: integer - x-nullable: true - counseledDate: - type: string - format: date - orderNumber: - description: not to be confused with Orders Number - type: string - example: 030-00362 - x-nullable: true - travelType: - description: Travel Type - example: Shipment of HHG Permitted + readOnly: true + updatedAt: + format: date-time type: string - travelClassCode: - example: PCS + readOnly: true + ppmType: type: string - financialReviewFlag: - type: boolean - x-nullable: true - financialReviewRemarks: + enum: + - FULL + - PARTIAL + eTag: type: string - x-nullable: true - shipments: - type: array - items: - $ref: '#/definitions/PPTASShipment' - PPTASReports: + readOnly: true + ListMoves: type: array items: - $ref: '#/definitions/PPTASReport' + $ref: '#/definitions/ListMove' ClientError: type: object properties: