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

feat: Add HTTP endpoints and workflows for price preference management #7960

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

sradevski
Copy link
Member

@sradevski sradevski commented Jul 4, 2024

REF CORE-2376

Remaining pieces are adding UI to manage the flag, showing the flag in price editor, plugging it in cart calculations, and #7827

@sradevski sradevski requested a review from a team as a code owner July 4, 2024 20:43
Copy link

vercel bot commented Jul 4, 2024

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

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2024 8:40am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Jul 5, 2024 8:40am
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 8:40am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 8:40am
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 8:40am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 8:40am
resources-docs ⬜️ Ignored (Inspect) Visit Preview Jul 5, 2024 8:40am

Copy link

changeset-bot bot commented Jul 4, 2024

⚠️ No Changeset found

Latest commit: b91d7e0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

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.

Nice work, clean PR 💪

@sradevski sradevski force-pushed the feat/add-workflow-http-price-preference branch from 10c5b63 to b91d7e0 Compare July 5, 2024 08:33
Copy link
Contributor

@riqwan riqwan left a comment

Choose a reason for hiding this comment

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

🥇

Comment on lines +23 to +33
async (pricePreferences, { container }) => {
if (!pricePreferences?.length) {
return
}

const pricingModule = container.resolve<IPricingModuleService>(
ModuleRegistrationName.PRICING
)

await pricingModule.deletePricePreferences(pricePreferences)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async (pricePreferences, { container }) => {
if (!pricePreferences?.length) {
return
}
const pricingModule = container.resolve<IPricingModuleService>(
ModuleRegistrationName.PRICING
)
await pricingModule.deletePricePreferences(pricePreferences)
}
async (ids, { container }) => {
if (!ids?.length) {
return
}
const pricingModule = container.resolve<IPricingModuleService>(
ModuleRegistrationName.PRICING
)
await pricingModule.deletePricePreferences(ids)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

damn the automerge was faster 😄 I'll open a new PR now anyway and address this.

ModuleRegistrationName.PRICING
)

await service.upsertPricePreferences(prevData)
Copy link
Contributor

Choose a reason for hiding this comment

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

q: shouldn't this be update as well?

Copy link
Member Author

@sradevski sradevski Jul 5, 2024

Choose a reason for hiding this comment

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

We pass the prevData as an array of entities, and only the Upsert method accepts such input. update is either an ID or a selector, which doesn't work for the reversal (we do this everywhere basically). I do think we might need to revisit the compensation methods in a lot of workflows and test them at the very least

@kodiakhq kodiakhq bot merged commit 3e86cb6 into develop Jul 5, 2024
21 of 23 checks passed
@sradevski sradevski deleted the feat/add-workflow-http-price-preference branch July 5, 2024 08:47
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