chore(order): aggregate statuses (#7497)

This commit is contained in:
Carlos R. L. Rodrigues
2024-05-29 07:05:42 -03:00
committed by GitHub
parent 8e66e10995
commit bbca54efa7
15 changed files with 577 additions and 48 deletions
@@ -1,3 +1,4 @@
import { getOrderDetailWorkflow } from "@medusajs/core-flows"
import {
ContainerRegistrationKeys,
remoteQueryObjectFromString,
@@ -11,18 +12,15 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse
) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const variables = { id: req.params.id }
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
const worklow = getOrderDetailWorkflow(req.scope)
const { result } = await worklow.run({
input: {
fields: req.remoteQueryConfig.fields,
order_id: req.params.id,
},
})
const [order] = await remoteQuery(queryObject)
res.status(200).json({ order })
res.status(200).json({ order: result })
}
export const POST = async (