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 support for setting sales channel when creating a product #6986

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

sradevski
Copy link
Member

No description provided.

@sradevski sradevski requested a review from a team as a code owner April 7, 2024 07:52
Copy link

changeset-bot bot commented Apr 7, 2024

⚠️ No Changeset found

Latest commit: a74e782

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

vercel bot commented Apr 7, 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 Apr 7, 2024 10:42am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Apr 7, 2024 10:42am
docs-ui ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2024 10:42am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Apr 7, 2024 10:42am

@@ -35,7 +35,7 @@ export const removeRemoteLinkStep = createStep(
)
await link.delete(grouped)

return new StepResponse(void 0, grouped)
Copy link
Member Author

Choose a reason for hiding this comment

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

There is a typing issue where if you return void 0 you cannot do .config on the step to change the name

}))
}
)
return createdProducts
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we refetch after a workflow, I think it's better to not bother and reconstruct the data for now

@@ -35,7 +35,7 @@ export const removeRemoteLinkStep = createStep(
)
await link.delete(grouped)

return new StepResponse(void 0, grouped)
return new StepResponse(grouped, grouped)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
return new StepResponse(grouped, grouped)
return new StepResponse(grouped)

@@ -202,6 +202,7 @@ export const AdminCreateProduct = z
tags: z.array(AdminUpdateProductTag).optional(),
options: z.array(AdminCreateProductOption).optional(),
variants: z.array(AdminCreateProductVariant).optional(),
sales_channels: z.array(z.object({ id: z.string() })).optional(),
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Should we allow string IDs too? I know this would be diverging from 1.0, but I don't see the benefit of constructing objects in the client.

Copy link
Member

Choose a reason for hiding this comment

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

I do agree, this is due to the legacy usage of providing ids, the naming was always referring to the target object. In other places we do allow the ids too instead of objects

Copy link
Member Author

Choose a reason for hiding this comment

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

@olivermrbl I tried not to introduce too many breaking changes in the API, but we can revisit once we have things working

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.

Other than Carlos' comment, LGTM

@sradevski sradevski force-pushed the feat/add-support-sales-channels-product branch from 3dbe35d to a74e782 Compare April 7, 2024 10:38
@sradevski sradevski merged commit 44bcde9 into develop Apr 7, 2024
24 checks passed
@sradevski sradevski deleted the feat/add-support-sales-channels-product branch April 7, 2024 11:45
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.

4 participants