Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[MINT-3157] Plan Data Exchange Data Loader #1407

Conversation

StevenWadeOddball
Copy link
Contributor

@StevenWadeOddball StevenWadeOddball commented Oct 8, 2024

MINT-3157

Description

This PR introduces a dataloader for the new type, plan data exchange. It uses the new version of dataloaders with generics.
--> Note, there is now generic sort and error functionality, but it still remains in PR. Once that is merged, this loader should also implement that sorting functionality, and error handling instead of the manual approach that happens in this PR.
--> Note, the failing front end tests are not caused by this PR, the FE development is still in progress.

--> This PR also introduces a generic function to validate the new loader structure. Effectively, a test suite just has to ensure that the data exists, and then specify a set of data to compare per key, and a function to specify how to compare it. This will remove a lot of the boiler plate code needed to test a new data loader.

How to test this change

  1. Seed the data base.
  2. Query model plans and retrieve the data exchange type.
  3. Ensure that the returned data matches the expected model plan
  4. Ensure all unit tests pass.

PR Author Checklist

  • I have provided a detailed description of the changes in this PR.
  • I have provided clear instructions on how to test the changes in this PR.
  • I have updated tests or written new tests as appropriate in this PR.
  • Updated the Postman Collection if necessary.

PR Reviewer Guidelines

  • It's best to pull the branch locally and test it, rather than just looking at the code online!
  • When approving a PR, provide a reason why you're approving it
    • e.g. "Approving because I tested it locally and all functionality works as expected"
    • e.g. "Approving because the change is simple and matches the Figma design"
  • Don't be afraid to leave comments or ask questions, especially if you don't understand why something was done! (This is often a great time to suggest code comments or documentation updates)
  • Check that all code is adequately covered by tests - if it isn't feel free to suggest the addition of tests.

@StevenWadeOddball StevenWadeOddball marked this pull request as ready for review October 8, 2024 18:35
@StevenWadeOddball StevenWadeOddball requested a review from a team as a code owner October 8, 2024 18:35
@StevenWadeOddball StevenWadeOddball requested review from OddTomBrooks and ClayBenson94 and removed request for a team October 8, 2024 18:35
@@ -77,3 +79,8 @@ func PlanDataExchangeApproachUpdate(
retDataExchangeApproach, err := storage.PlanDataExchangeApproachUpdate(store, logger, existing)
return retDataExchangeApproach, err
}

// PlanDataExchangeApproachGetByModelPlanIDLoader calls a data loader to batch fetching a a plan data exchange object that corresponds to a model plan
func PlanDataExchangeApproachGetByModelPlanIDLoader(ctx context.Context, modelPlanID uuid.UUID) (*models.PlanDataExchangeApproach, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the introduction of this function, do we still need PlanDataExchangeApproachGetByID?

@StevenWadeOddball StevenWadeOddball merged commit 57538b1 into feature/MINT-2720_data_exchange Oct 11, 2024
8 of 11 checks passed
@StevenWadeOddball StevenWadeOddball deleted the task/MINT-3157_data_exchange_data_loader branch October 11, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants