feat(core-flows): order edit request (#8705)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-21 13:59:33 -03:00
committed by GitHub
parent f3e4b7dfd0
commit 27a2dcb10d
8 changed files with 176 additions and 4 deletions
@@ -0,0 +1,21 @@
import { requestOrderEditRequestWorkflow } from "@medusajs/core-flows"
import { HttpTypes } from "@medusajs/types"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "../../../../../types/routing"
export const POST = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
) => {
const { id } = req.params
const { result } = await requestOrderEditRequestWorkflow(req.scope).run({
input: { order_id: id },
})
res.json({
order_preview: result,
})
}
@@ -71,6 +71,11 @@ export const adminOrderEditRoutesMiddlewares: MiddlewareRoute[] = [
matcher: "/admin/order-edits/:id/confirm",
middlewares: [],
},
{
method: ["POST"],
matcher: "/admin/order-edits/:id/request",
middlewares: [],
},
{
method: ["DELETE"],
matcher: "/admin/order-edits/:id",