fix(medusa): fix complete order API route to remove duplicate params (#8961)
Remove the `order_id` request body param from the complete order API route and use the `id` path parameter instead.
This commit is contained in:
1 parent
123118ac8e
commit
9a34e03ae1
2 files changed
+3
-8
No files matched your search
@@ -8,10 +8,9 @@ import {
|
|||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../../types/routing"
|
} from "../../../../../types/routing"
|
||||||
import { AdminCompleteOrderType } from "../../validators"
|
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCompleteOrderType & AdditionalData>,
|
req: AuthenticatedMedusaRequest<AdditionalData>,
|
||||||
res: MedusaResponse<HttpTypes.AdminOrderResponse>
|
res: MedusaResponse<HttpTypes.AdminOrderResponse>
|
||||||
) => {
|
) => {
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
@@ -19,7 +18,7 @@ export const POST = async (
|
|||||||
|
|
||||||
await completeOrderWorkflow(req.scope).run({
|
await completeOrderWorkflow(req.scope).run({
|
||||||
input: {
|
input: {
|
||||||
orderIds: [req.validatedBody.order_id],
|
orderIds: [id],
|
||||||
additional_data: req.validatedBody.additional_data,
|
additional_data: req.validatedBody.additional_data,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -52,11 +52,7 @@ export const AdminArchiveOrder = z.object({
|
|||||||
})
|
})
|
||||||
export type AdminArchiveOrderType = z.infer<typeof AdminArchiveOrder>
|
export type AdminArchiveOrderType = z.infer<typeof AdminArchiveOrder>
|
||||||
|
|
||||||
export type AdminCompleteOrderType = z.infer<typeof CompleteOrder>
|
export const AdminCompleteOrder = WithAdditionalData(z.object({}))
|
||||||
export const CompleteOrder = z.object({
|
|
||||||
order_id: z.string(),
|
|
||||||
})
|
|
||||||
export const AdminCompleteOrder = WithAdditionalData(CompleteOrder)
|
|
||||||
|
|
||||||
const Item = z.object({
|
const Item = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
|||||||
Reference in new issue
Block a user