Skip to content

Commit

Permalink
Merge pull request #13699 from transcom/revert-13226-B-20001
Browse files Browse the repository at this point in the history
Revert "B-20001"
  • Loading branch information
pambecker authored Sep 12, 2024
2 parents 1fd5aac + fd03584 commit 2072292
Show file tree
Hide file tree
Showing 57 changed files with 1,351 additions and 6,973 deletions.
8 changes: 4 additions & 4 deletions cmd/pptas-api-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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(&params)
resp, err := primeGateway.Moves.ListMoves(&params)
if err != nil {
currentTime := time.Now()
if currentTime.Sub(startTime) > wait {
Expand Down
6 changes: 3 additions & 3 deletions pkg/gen/pptasapi/configure_mymove.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}

Expand Down
Loading

0 comments on commit 2072292

Please sign in to comment.