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

fix(medusa, utils): fix the way selects are consumed alongside the relations #4389

Merged
merged 22 commits into from
Jun 29, 2023

Conversation

adrien2p
Copy link
Member

@adrien2p adrien2p commented Jun 22, 2023

What
There is actually an issue with using the fields query params with the way the repositories are using our custom query strategy. This pr aims to fix this issue by reworking the strategy.

What we had to do was to rework the way the selects are built for each subquery in order to follow the aliasing convention and to be taken into consideration. Alongside these changes, the join used to always select everything, this needed to be changed so that if there are any selects provided for a join, the join should not select everything and let the query select the fields that are requested.

Another notable change is that all the repositories are now using the repository util in order to centralize the customization and to have a single place to update when this kind of issue arises. This means that the eager relations when using the query builder are not necessarily taken into account. For that reason, I have removed the shipping_option eager option in favor of explicitly asking for the relations like we started to do it in some places.

FIXES CORE-1413

@changeset-bot
Copy link

changeset-bot bot commented Jun 22, 2023

🦋 Changeset detected

Latest commit: ba17e8a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@medusajs/medusa Patch
@medusajs/admin-ui Patch
@medusajs/admin Patch
medusa-plugin-brightpearl Patch
medusa-plugin-segment Patch
medusa-plugin-sendgrid Patch
medusa-plugin-slack-notification Patch
@medusajs/utils Patch
@medusajs/medusa-oas-cli Patch
@medusajs/oas-github-ci Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 29, 2023 1:20pm

@adrien2p
Copy link
Member Author

/snapshot-this

@github-actions
Copy link
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshot by updating your package.json with the newly published version:

yarn add @medusajs/[email protected]

Latest commit: 14bfe6d

@adrien2p
Copy link
Member Author

/snapshot-this

@github-actions
Copy link
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshots by updating your package.json with the newly published versions:

yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]

Latest commit: 14bfe6d

@adrien2p
Copy link
Member Author

@olivermrbl I had to re introduce the variants.prices.amount otherwise we are not allowed to order by this column

@adrien2p adrien2p marked this pull request as ready for review June 23, 2023 07:46
@adrien2p adrien2p requested a review from a team as a code owner June 23, 2023 07:46
@adrien2p adrien2p requested a review from riqwan June 23, 2023 08:13
Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

Can I get you to add a couple of sentences describing what needed to be done around strategies? I think that will make for an easier review :)

@adrien2p
Copy link
Member Author

Can I get you to add a couple of sentences describing what needed to be done around strategies? I think that will make for an easier review :)

done, what do you think?

@adrien2p
Copy link
Member Author

@olivermrbl wdyt?

@olivermrbl
Copy link
Contributor

/snapshot-this

@github-actions
Copy link
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshots by updating your package.json with the newly published versions:

yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]

Latest commit: 9760d4a

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

LGTM!

@kodiakhq kodiakhq bot merged commit 9dcdc00 into develop Jun 29, 2023
@kodiakhq kodiakhq bot deleted the fix/repository-utils-select-and-relations branch June 29, 2023 13:26
@github-actions github-actions bot mentioned this pull request Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants