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

DEVPROD-10201: Improve mapping between GraphQL User type and APIDBUser struct #8340

Merged
merged 8 commits into from
Sep 25, 2024

Conversation

minnakt
Copy link
Contributor

@minnakt minnakt commented Sep 24, 2024

DEVPROD-10201

Description

I noticed that the way in which we process a User in GraphQL doesn't follow the patterns we have elsewhere. This PR updates the logic around APIDBUser which is the underlying model for User in GraphQL.

Testing

  • Existing tests should pass
  • Tested via /graphql sandbox

Copy link
Contributor Author

@minnakt minnakt Sep 24, 2024

Choose a reason for hiding this comment

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

this is legacy generated code but according to the comments manual edits are allowed? The legacy codegen tool was already removed from Evergreen a while ago DEVPROD-971

@minnakt minnakt marked this pull request as ready for review September 24, 2024 18:41
@minnakt minnakt requested review from a team September 24, 2024 18:41
dbUser := restModel.APIDBUserToService(toUpdate)

dbUser, err := toUpdate.ToService()
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: nil check dbUser

restModel "github.com/evergreen-ci/evergreen/rest/model"
"github.com/evergreen-ci/utility"
)

// ParsleyFilters is the resolver for the parsleyFilters field.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this removal intended? Was the removal generated?

Copy link
Contributor Author

@minnakt minnakt Sep 25, 2024

Choose a reason for hiding this comment

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

now that we use the complete APIDBUser as the underlying model, these get automatically resolved so we don't have to write any resolver code for them 🙂

Here's an example of this still working (running locally on this PR):

Screenshot 2024-09-25 at 10 03 59 AM

@minnakt minnakt requested a review from hadjri September 25, 2024 15:55
@minnakt minnakt changed the title DEVPROD-10201: Improve GraphQL mapping from User to APIDBUser DEVPROD-10201: Improve mapping from GraphQL User type to APIDBUser struct Sep 25, 2024
@minnakt minnakt changed the title DEVPROD-10201: Improve mapping from GraphQL User type to APIDBUser struct DEVPROD-10201: Improve mapping between GraphQL User type and APIDBUser struct Sep 25, 2024
@minnakt minnakt merged commit 0efdd3c into evergreen-ci:main Sep 25, 2024
10 checks passed
@minnakt minnakt deleted the DEVPROD-10201 branch September 25, 2024 22:04
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.

3 participants