-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(orchestration,core-flows,medusa,product,types,utils): product import/export uses workflows #5811
Conversation
🦋 Changeset detectedLatest commit: ec7f1c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Ignored Deployments
|
packages/medusa/src/utils/queries/products/get-variants-from-price-list.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of changes that I would like to see but it looks great! I really like the refactoring of the module-queries into utils 💪
integration-tests/plugins/__tests__/product/admin/import-products.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@riqwan feel free to merge as you please :) |
for (const [ | ||
product_id, | ||
variantsUpdateData = [], | ||
] of productVariantsMap.entries()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: entries is not required, a map is iterable and will return the entries
packages/core-flows/src/handlers/product/update-product-variants.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I have a few todo as well
@@ -37,6 +36,7 @@ export default class ProductExportStrategy extends AbstractBatchJobStrategy { | |||
protected readonly productService_: ProductService | |||
protected readonly fileService_: IFileService | |||
protected readonly featureFlagRouter_: FlagRouter | |||
protected readonly remoteQuery_: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: We have a type for the remoteQuery if I am correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will address this in a follow up PR, saw this too late.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@riqwan have you done the followup pr?
;[productList, count] = await this.productService_ | ||
.withTransaction(transactionManager) | ||
.listAndCount(filterable_fields, { | ||
...(list_config ?? {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: since listConfig has a default value being {}. we can remove ?? {} right?
filterable_fields, | ||
{ | ||
...list_config, | ||
take: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: why don't we use the take here? the issue is that we are fetching everything here
{ | ||
...list_config, | ||
skip: offset, | ||
take: Math.min(productCount - offset, limit), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: move that to a const above to be used in both cases
@@ -565,6 +616,10 @@ class ProductImportStrategy extends AbstractBatchJobStrategy { | |||
return | |||
} | |||
|
|||
const isMedusaV2Enabled = this.featureFlagRouter_.isFeatureEnabled( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: should we move that on the class level to be accessible everywhere? like a getter for example
await this.productVariantService_ | ||
.withTransaction(transactionManager) | ||
.create(product!, variant as unknown as CreateProductVariantInput) | ||
if (isMedusaV2Enabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: In general, the workflows accept a collection of element, we should use that batch approach in a follow up pr. cc @olivermrbl @carlos-r-l-rodrigues
|
||
export function createContainerLike(obj): ContainerLike { | ||
return { | ||
resolve(key: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: resolve<T = unknown>(key: string): T
No description provided.