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

Add new query getOrganizationsByEmailPaginated #157

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

vhaalmeida
Copy link
Contributor

What problem is this solving?

This new query will allow to retrieve the users' organizations paginated.
Currently when an user is associated to a big number of organizations is generating a timeout.

How should this be manually tested?
Access https://timeoutsfp--jamalstore.myvtex.com/admin/graphql-ide
Run the query below in the storefront-permissions app

{
  getOrganizationsByEmailPaginated(
    email: "victor.almeida+2@vtex.com",
    page: 1
    pageSize: 25
  ) {
    data {
      id
      clId
     	costId
      orgId
    }
    pagination {
      page
      pageSize
      total
    }
  }
}

Screenshots or example usage:
image

Copy link

vtex-io-ci-cd bot commented Aug 29, 2024

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

Copy link

github-actions bot commented Aug 29, 2024

Messages
📖 ❤️ Thanks!
📖

🎉 PR additions = 57, PR deletions = 0

Generated by 🚫 dangerJS against c5da41d

Copy link
Collaborator

@wender wender left a comment

Choose a reason for hiding this comment

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

A few changes needed

node/resolvers/Queries/Users.ts Outdated Show resolved Hide resolved
node/resolvers/Queries/Users.ts Outdated Show resolved Hide resolved
node/resolvers/Queries/Users.ts Outdated Show resolved Hide resolved
@wender wender self-requested a review August 30, 2024 17:12
node/resolvers/Queries/Users.ts Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Sep 29, 2024

const data = await masterdata.searchDocumentsWithPaginationInfo({
dataEntity: config.name,
fields: ['clId', 'costId', 'id', 'orgId', 'roleId'],
pagination: { page, pageSize },
Copy link
Contributor

Choose a reason for hiding this comment

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

when querying paginated data from Master Data, we should add sort (e.g. sort: 'id asc', otherwise we might get inconsistent data result (e.g. duplicated entries) when querying a lot of data/pages.

@@ -816,6 +816,44 @@ export const getOrganizationsByEmail = async (
}
}

export const getOrganizationsByEmailPaginated = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

For me, it doesn't make sense to implement the query here, it should be implemented on b2b-organization-graphql.

@enzomerca enzomerca requested a review from a team October 22, 2024 16:24
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.

4 participants