feat(core-flows,medusa,order): remove return shipping (#8137)
What: * `DELETE /admin/returs/:id/shipping_methods/:action_id` FIXES: CC-187
This commit is contained in:
1 parent
b7e6b1461b
commit
7123f9ff63
22 files changed
+383
-23
No files matched your search
@@ -1252,6 +1252,66 @@ export default class OrderModuleService<
|
||||
return sm.map((s) => s.shipping_method)
|
||||
}
|
||||
|
||||
@InjectManager("baseRepository_")
|
||||
// @ts-ignore
|
||||
async softDeleteShippingMethods<TReturnableLinkableKeys extends string>(
|
||||
ids: string | object | string[] | object[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
@MedusaContext() sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void> {
|
||||
const rel = await super.listOrderShippingMethods(
|
||||
{
|
||||
shipping_method_id: ids,
|
||||
},
|
||||
{
|
||||
select: ["id"],
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
const orderShippingMethodIds = rel.map((r) => r.id)
|
||||
|
||||
const [returned] = await promiseAll([
|
||||
super.softDeleteShippingMethods(ids, config, sharedContext),
|
||||
super.softDeleteOrderShippingMethods(
|
||||
orderShippingMethodIds,
|
||||
config,
|
||||
sharedContext
|
||||
),
|
||||
])
|
||||
|
||||
return returned
|
||||
}
|
||||
|
||||
@InjectManager("baseRepository_")
|
||||
// @ts-ignore
|
||||
async restoreShippingMethods<TReturnableLinkableKeys extends string>(
|
||||
transactionIds: string | object | string[] | object[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
@MedusaContext() sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void> {
|
||||
const rel = await super.listOrderShippingMethods(
|
||||
{
|
||||
shipping_method_id: transactionIds,
|
||||
},
|
||||
{
|
||||
select: ["id"],
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
const orderShippingMethodIds = rel.map((r) => r.id)
|
||||
|
||||
const [returned] = await promiseAll([
|
||||
super.restoreShippingMethods(transactionIds, config, sharedContext),
|
||||
super.restoreOrderShippingMethods(
|
||||
orderShippingMethodIds,
|
||||
config,
|
||||
sharedContext
|
||||
),
|
||||
])
|
||||
|
||||
return returned
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
async createLineItemAdjustments(
|
||||
adjustments: OrderTypes.CreateOrderLineItemAdjustmentDTO[]
|
||||
@@ -2014,6 +2074,7 @@ export default class OrderModuleService<
|
||||
delete item.actions
|
||||
|
||||
const newItem = itemsToUpsert.find((d) => d.item_id === item.id)!
|
||||
|
||||
calculated.order.items[idx] = {
|
||||
...lineItem,
|
||||
actions,
|
||||
|
||||
Reference in new issue
Block a user