REF CORE-2376 Remaining pieces are adding UI to manage the flag, showing the flag in price editor, plugging it in cart calculations, and https://github.com/medusajs/medusa/pull/7827
39 lines
818 B
TypeScript
39 lines
818 B
TypeScript
import { getOrdersListWorkflow } from "@medusajs/core-flows"
|
|
import { OrderDTO } from "@medusajs/types"
|
|
import {
|
|
AuthenticatedMedusaRequest,
|
|
MedusaResponse,
|
|
} from "../../../types/routing"
|
|
|
|
export const GET = async (
|
|
req: AuthenticatedMedusaRequest,
|
|
res: MedusaResponse
|
|
) => {
|
|
const variables = {
|
|
filters: {
|
|
...req.filterableFields,
|
|
is_draft_order: false,
|
|
},
|
|
...req.remoteQueryConfig.pagination,
|
|
}
|
|
|
|
const workflow = getOrdersListWorkflow(req.scope)
|
|
const { result } = await workflow.run({
|
|
input: {
|
|
fields: req.remoteQueryConfig.fields,
|
|
variables,
|
|
},
|
|
})
|
|
|
|
const { rows, metadata } = result as {
|
|
rows: OrderDTO[]
|
|
metadata: any
|
|
}
|
|
res.json({
|
|
orders: rows,
|
|
count: metadata.count,
|
|
offset: metadata.skip,
|
|
limit: metadata.take,
|
|
})
|
|
}
|