fix(order): remove nested entities (#8250)

This commit is contained in:
Carlos R. L. Rodrigues
2024-07-23 15:21:33 -03:00
committed by GitHub
parent 1aa2d7b611
commit cae27b08bd
2 changed files with 14 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import {
decorateCartTotals,
deduplicate,
isDefined,
isObject,
} from "@medusajs/utils"
// Reshape the order object to match the OrderDTO
@@ -99,10 +100,15 @@ export function formatOrder(
}
function cleanNestedRelations(obj) {
delete obj.order
delete obj.return
delete obj.claim
delete obj.exchange
if (!isObject(obj)) {
return
}
const obj_ = obj as any
delete obj_.order
delete obj_.return
delete obj_.claim
delete obj_.exchange
}
function formatOrderReturn(orderReturn, mainOrder) {