fix(order): remove nested entities (#8250)
This commit is contained in:
committed by
GitHub
parent
1aa2d7b611
commit
cae27b08bd
@@ -380,6 +380,10 @@ medusaIntegrationTestRunner({
|
||||
{},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
result = (await api.get(`/admin/returns?fields=*items`, adminHeaders))
|
||||
.data.returns
|
||||
expect(result).toHaveLength(2)
|
||||
})
|
||||
|
||||
// Simple lifecyle:
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user