feat: move create inventory to @medusajs/workflows (#5301)
**Why** - We have some workflow-like flows in @medusajs/medusa. These should be moved over to the workflows package. - Inventory Items <> Variant currently assume a 1-1 mapping. There should be support for a many-to-many mapping. **What** - PR introduces a feature flag for supporting many-to-many mappings for inventory and variants. - Deletes legacy transaction handler in @medusajs/medusa. - Adjusts existing createInventoryItems handler to remove dependency on variant data. **Unkowns** ~~1. Couldn't find an existing test for the CreateProduct workflow. It should be tested that this still works as expected.~~ 2. Have removed transaction managers as we should move to handling consistency through orchestration tooling. Are we ready for that?
This commit is contained in:
@@ -41,7 +41,7 @@ export function buildQuery<TWhereKeys extends object, TEntity = unknown>(
|
||||
where: buildWhere<TWhereKeys, TEntity>(selector),
|
||||
}
|
||||
|
||||
if ("deleted_at" in selector) {
|
||||
if ("deleted_at" in selector || config.withDeleted) {
|
||||
query.withDeleted = true
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ export function getListQuery(
|
||||
queryBuilder.select(legacySelect.map((s) => "inv_item." + s))
|
||||
}
|
||||
|
||||
if (query.withDeleted) {
|
||||
queryBuilder.withDeleted()
|
||||
}
|
||||
|
||||
if (query.order) {
|
||||
const toSelect: string[] = []
|
||||
const parsed = Object.entries(query.order).reduce((acc, [k, v]) => {
|
||||
|
||||
Reference in New Issue
Block a user