-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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(modules-sdk,link-modules,orchestration,inventory,product,stock-location): link modules #4637
Conversation
🦋 Changeset detectedLatest commit: 25a9edc The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 ↗︎ 1 Ignored Deployment
|
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 am stopping the review here as I just saw that it wasn't ready sorry man. Let's huddle if needed
}, | ||
"dependencies": { | ||
"@medusajs/modules-sdk": "^1.8.8", | ||
"@medusajs/types": "^1.8.11", |
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: dev deps
{ | ||
name: "product_variant_inventory_item", | ||
}, | ||
{ | ||
name: "product_variant_inventory_items", | ||
}, |
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: duplicate
serviceName: Modules.PRODUCT, | ||
primaryKey: "id", | ||
foreignKey: "variant_id", | ||
alias: "variant", | ||
args: { | ||
methodSuffix: "Variants", | ||
}, |
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: shouldn't it be a list of variants on which we retrieve and attach the inventory item?
import { getLoaders } from "../loaders" | ||
import { getMigration } from "../migration" | ||
|
||
type ILinkModule = {} |
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 should change that no?
|
||
if (definition.relationships?.length !== 2 && !definition.isReadOnlyLink) { | ||
throw new Error( | ||
`Link module ${definition.serviceName} must have 2 relationships.` |
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.
question: shouldn't it be at least and not strict? unless it has 2 relationships and then the rest is just the extends?
config: FindConfig<unknown> = {}, | ||
sharedContext?: Context | ||
): Promise<[ProductTypes.ProductDTO[], number]> { | ||
const [products, count] = await this.pivotService_.listAndCount( |
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: rename the const to something more generic
} | ||
|
||
@InjectTransactionManager(shouldForceTransaction, "baseRepository_") | ||
async create(data: unknown[], @MedusaContext() sharedContext: Context = {}) { |
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: create a protected method such as create_
that is wrapped in a transaction and call it here, then call the serialize from the base repository on the result. Otherwise here we are returning a mikro orm object
productIds: string[], | ||
@MedusaContext() sharedContext: Context = {} | ||
): Promise<TPivot[]> { | ||
return await this.pivotService_.softDelete(productIds, sharedContext) |
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: same as previous
productIds: string[], | ||
@MedusaContext() sharedContext: Context = {} | ||
): Promise<TPivot[]> { | ||
return await this.pivotService_.restore(productIds, sharedContext) |
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: sam as previous
@@ -0,0 +1,97 @@ | |||
import { Context, DAL, FindConfig } from "@medusajs/types" |
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: this file, missing all the decorators
What:
Default package containing all Medusa's link modules definition and manage the creation of pre-defined or custom links.