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

refactor of roles service to allow separately querying journey roles from org roles #3177

Merged
merged 8 commits into from
Sep 1, 2023

Conversation

techsmyth
Copy link
Member

@techsmyth techsmyth commented Aug 30, 2023

Rational for this PR is that the userRoles query always was getting both all journey roles and all organization roles - regardless of what fields were being requested. And in the latest update from Andrew the code does request the different roles separately - which leads to an inefficient api.

The graphql api has not changed, this is a pure internal optimization that is important to allow client querying of organizational roles to be fast - currently it is still getting all the journey roles in the business logic.

Design:

  • The entity that is returned from userRoles / organizationRoles is pretty much empty, storing only information that is needed for the fields on it.
  • All data is now returned as fields, allowing for retrieving of journey roles separate from organization roles.

Important is that the logic path for organization roles is now fully independent of that of journey roles, as they are different (space visibilities etc makes no sense on organization roles).

@valentinyanakiev valentinyanakiev requested review from hero101 and removed request for valentinyanakiev September 1, 2023 08:45
Copy link
Contributor

@hero101 hero101 left a comment

Choose a reason for hiding this comment

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

I see a lot of async/await in your code that are not required.
You can think of the await basically as execution. It should only be used if you need the value right now, in your next line, otherwise, you just pass around the promise.

Overall the implementations look good. An additional optimization leveraged by resolvers.

hero101
hero101 previously approved these changes Sep 1, 2023
@hero101 hero101 merged commit ed12438 into develop Sep 1, 2023
2 checks passed
@hero101 hero101 deleted the server-3176 branch September 1, 2023 14:50
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.

None yet

3 participants