feat(core-flow): order edit endpoints (#8596)
* The relevant part of this PR is only at folder `packages/medusa/src/api/admin/order-edits/` All the other changes are Types Missing: * `/store` endpoints to confirm/decline the order change * http tests of the full flow
This commit is contained in:
1 parent
b23ddcdde8
commit
c92aa3e397
63 files changed
+598
-90
No files matched your search
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -49,7 +50,7 @@ export const orderClaimAddNewItemWorkflow = createWorkflow(
|
|||||||
orderClaimAddNewItemWorkflowId,
|
orderClaimAddNewItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderClaimAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderClaimAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim = useRemoteQueryStep({
|
const orderClaim = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "order_id", "canceled_at"],
|
fields: ["id", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -48,7 +49,7 @@ export const orderClaimItemWorkflow = createWorkflow(
|
|||||||
orderClaimItemWorkflowId,
|
orderClaimItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderClaimItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderClaimItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim = useRemoteQueryStep({
|
const orderClaim = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "order_id", "canceled_at"],
|
fields: ["id", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -60,7 +61,7 @@ export const orderClaimRequestItemReturnWorkflow = createWorkflow(
|
|||||||
orderClaimRequestItemReturnWorkflowId,
|
orderClaimRequestItemReturnWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderClaimRequestItemReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderClaimRequestItemReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim = useRemoteQueryStep({
|
const orderClaim = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "order_id", "return_id", "canceled_at"],
|
fields: ["id", "order_id", "return_id", "canceled_at"],
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ChangeActionType,
|
ChangeActionType,
|
||||||
@@ -183,7 +184,7 @@ export const confirmClaimRequestWorkflow = createWorkflow(
|
|||||||
confirmClaimRequestWorkflowId,
|
confirmClaimRequestWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: ConfirmClaimRequestWorkflowInput
|
input: ConfirmClaimRequestWorkflowInput
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
@@ -52,7 +53,7 @@ export const createClaimShippingMethodWorkflow = createWorkflow(
|
|||||||
claim_id?: string
|
claim_id?: string
|
||||||
shipping_option_id: string
|
shipping_option_id: string
|
||||||
custom_price?: BigNumberInput
|
custom_price?: BigNumberInput
|
||||||
}): WorkflowResponse<OrderDTO> {
|
}): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -64,7 +65,7 @@ export const removeAddItemClaimActionWorkflow = createWorkflow(
|
|||||||
removeAddItemClaimActionWorkflowId,
|
removeAddItemClaimActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteOrderClaimItemActionWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteOrderClaimItemActionWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -94,7 +95,12 @@ export const removeAddItemClaimActionWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeClaimAddItemActionValidationStep({ order, input, orderClaim, orderChange })
|
removeClaimAddItemActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderClaim,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -64,7 +65,7 @@ export const removeItemClaimActionWorkflow = createWorkflow(
|
|||||||
removeItemClaimActionWorkflowId,
|
removeItemClaimActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteOrderClaimItemActionWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteOrderClaimItemActionWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -94,7 +95,12 @@ export const removeItemClaimActionWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeClaimItemActionValidationStep({ order, input, orderClaim, orderChange })
|
removeClaimItemActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderClaim,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -65,7 +65,7 @@ export const removeClaimShippingMethodWorkflow = createWorkflow(
|
|||||||
removeClaimShippingMethodWorkflowId,
|
removeClaimShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteClaimShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteClaimShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -68,7 +69,7 @@ export const updateClaimAddItemWorkflow = createWorkflow(
|
|||||||
updateClaimAddItemWorkflowId,
|
updateClaimAddItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateClaimAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateClaimAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -68,7 +69,7 @@ export const updateClaimItemWorkflow = createWorkflow(
|
|||||||
updateClaimItemWorkflowId,
|
updateClaimItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateClaimItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateClaimItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderClaimDTO,
|
OrderClaimDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -67,7 +67,7 @@ export const updateClaimShippingMethodWorkflow = createWorkflow(
|
|||||||
updateClaimShippingMethodWorkflowId,
|
updateClaimShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateClaimShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateClaimShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
const orderClaim: OrderClaimDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_claim",
|
entry_point: "order_claim",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, Modules, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, Modules, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
@@ -173,7 +174,9 @@ export const confirmExchangeRequestWorkflowId = "confirm-exchange-request"
|
|||||||
*/
|
*/
|
||||||
export const confirmExchangeRequestWorkflow = createWorkflow(
|
export const confirmExchangeRequestWorkflow = createWorkflow(
|
||||||
confirmExchangeRequestWorkflowId,
|
confirmExchangeRequestWorkflowId,
|
||||||
function (input: ConfirmExchangeRequestWorkflowInput): WorkflowResponse<OrderDTO> {
|
function (
|
||||||
|
input: ConfirmExchangeRequestWorkflowInput
|
||||||
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
+2
-1
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
@@ -52,7 +53,7 @@ export const createExchangeShippingMethodWorkflow = createWorkflow(
|
|||||||
exchange_id?: string
|
exchange_id?: string
|
||||||
shipping_option_id: string
|
shipping_option_id: string
|
||||||
custom_price?: BigNumberInput
|
custom_price?: BigNumberInput
|
||||||
}): WorkflowResponse<OrderDTO> {
|
}): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -49,7 +50,7 @@ export const orderExchangeAddNewItemWorkflow = createWorkflow(
|
|||||||
orderExchangeAddNewItemWorkflowId,
|
orderExchangeAddNewItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderExchangeAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderExchangeAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange = useRemoteQueryStep({
|
const orderExchange = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "order_id", "canceled_at"],
|
fields: ["id", "order_id", "canceled_at"],
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -60,7 +61,7 @@ export const orderExchangeRequestItemReturnWorkflow = createWorkflow(
|
|||||||
orderExchangeRequestItemReturnWorkflowId,
|
orderExchangeRequestItemReturnWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderExchangeRequestItemReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderExchangeRequestItemReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange = useRemoteQueryStep({
|
const orderExchange = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "order_id", "return_id", "canceled_at"],
|
fields: ["id", "order_id", "return_id", "canceled_at"],
|
||||||
|
|||||||
+8
-2
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -64,7 +65,7 @@ export const removeItemExchangeActionWorkflow = createWorkflow(
|
|||||||
removeItemExchangeActionWorkflowId,
|
removeItemExchangeActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteOrderExchangeItemActionWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteOrderExchangeItemActionWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -94,7 +95,12 @@ export const removeItemExchangeActionWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeExchangeItemActionValidationStep({ order, input, orderExchange, orderChange })
|
removeExchangeItemActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderExchange,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -65,7 +65,7 @@ export const removeExchangeShippingMethodWorkflow = createWorkflow(
|
|||||||
removeExchangeShippingMethodWorkflowId,
|
removeExchangeShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteExchangeShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteExchangeShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -87,7 +87,11 @@ export const removeExchangeShippingMethodWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeExchangeShippingMethodValidationStep({ orderExchange, orderChange, input })
|
removeExchangeShippingMethodValidationStep({
|
||||||
|
orderExchange,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
const dataToRemove = transform(
|
const dataToRemove = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -68,7 +69,7 @@ export const updateExchangeAddItemWorkflow = createWorkflow(
|
|||||||
updateExchangeAddItemWorkflowId,
|
updateExchangeAddItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateExchangeAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateExchangeAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -98,7 +99,12 @@ export const updateExchangeAddItemWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
updateExchangeAddItemValidationStep({ order, input, orderExchange, orderChange })
|
updateExchangeAddItemValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderExchange,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
const updateData = transform(
|
const updateData = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
|
||||||
OrderExchangeDTO,
|
OrderExchangeDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -67,7 +67,7 @@ export const updateExchangeShippingMethodWorkflow = createWorkflow(
|
|||||||
updateExchangeShippingMethodWorkflowId,
|
updateExchangeShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateExchangeShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateExchangeShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
const orderExchange: OrderExchangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_exchange",
|
entry_point: "order_exchange",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -39,6 +39,15 @@ export * from "./exchange/update-exchange-add-item"
|
|||||||
export * from "./exchange/update-exchange-shipping-method"
|
export * from "./exchange/update-exchange-shipping-method"
|
||||||
export * from "./get-order-detail"
|
export * from "./get-order-detail"
|
||||||
export * from "./get-orders-list"
|
export * from "./get-orders-list"
|
||||||
|
export * from "./order-edit/begin-order-edit"
|
||||||
|
export * from "./order-edit/cancel-begin-order-edit"
|
||||||
|
export * from "./order-edit/confirm-order-edit-request"
|
||||||
|
export * from "./order-edit/create-order-edit-shipping-method"
|
||||||
|
export * from "./order-edit/order-edit-add-new-item"
|
||||||
|
export * from "./order-edit/remove-order-edit-item-action"
|
||||||
|
export * from "./order-edit/remove-order-edit-shipping-method"
|
||||||
|
export * from "./order-edit/update-order-edit-add-item"
|
||||||
|
export * from "./order-edit/update-order-edit-shipping-method"
|
||||||
export * from "./return/begin-receive-return"
|
export * from "./return/begin-receive-return"
|
||||||
export * from "./return/begin-return"
|
export * from "./return/begin-return"
|
||||||
export * from "./return/cancel-receive-return"
|
export * from "./return/cancel-receive-return"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { throwIfOrderIsCancelled } from "../../utils/order-validation"
|
|||||||
/**
|
/**
|
||||||
* This step validates that an order-edit can be requested for an order.
|
* This step validates that an order-edit can be requested for an order.
|
||||||
*/
|
*/
|
||||||
export const beginOrderOrderEditValidationStep = createStep(
|
export const beginorderEditValidationStep = createStep(
|
||||||
"begin-order-edit-validation",
|
"begin-order-edit-validation",
|
||||||
async function ({ order }: { order: OrderDTO }) {
|
async function ({ order }: { order: OrderDTO }) {
|
||||||
throwIfOrderIsCancelled({ order })
|
throwIfOrderIsCancelled({ order })
|
||||||
@@ -27,7 +27,7 @@ export const beginOrderEditOrderWorkflowId = "begin-order-edit-order"
|
|||||||
export const beginOrderEditOrderWorkflow = createWorkflow(
|
export const beginOrderEditOrderWorkflow = createWorkflow(
|
||||||
beginOrderEditOrderWorkflowId,
|
beginOrderEditOrderWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.BeginOrderOrderEditWorkflowInput>
|
input: WorkflowData<OrderWorkflow.BeginorderEditWorkflowInput>
|
||||||
): WorkflowResponse<OrderChangeDTO> {
|
): WorkflowResponse<OrderChangeDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
@@ -37,7 +37,7 @@ export const beginOrderEditOrderWorkflow = createWorkflow(
|
|||||||
throw_if_key_not_found: true,
|
throw_if_key_not_found: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
beginOrderOrderEditValidationStep({ order })
|
beginorderEditValidationStep({ order })
|
||||||
|
|
||||||
const orderChangeInput = transform({ input }, ({ input }) => {
|
const orderChangeInput = transform({ input }, ({ input }) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
import { OrderChangeDTO, OrderDTO } from "@medusajs/types"
|
import { OrderChangeDTO, OrderDTO, OrderPreviewDTO } from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
WorkflowResponse,
|
WorkflowResponse,
|
||||||
@@ -45,7 +45,7 @@ export const confirmOrderEditRequestWorkflow = createWorkflow(
|
|||||||
confirmOrderEditRequestWorkflowId,
|
confirmOrderEditRequestWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: ConfirmOrderEditRequestWorkflowInput
|
input: ConfirmOrderEditRequestWorkflowInput
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
fields: [
|
fields: [
|
||||||
@@ -117,7 +117,7 @@ export const confirmOrderEditRequestWorkflow = createWorkflow(
|
|||||||
variables: { id: input.order_id },
|
variables: { id: input.order_id },
|
||||||
list: false,
|
list: false,
|
||||||
throw_if_key_not_found: true,
|
throw_if_key_not_found: true,
|
||||||
}).config({ name: "order-query" })
|
}).config({ name: "order-items-query" })
|
||||||
|
|
||||||
const { variants, items } = transform({ orderItems }, ({ orderItems }) => {
|
const { variants, items } = transform({ orderItems }, ({ orderItems }) => {
|
||||||
const allItems: any[] = []
|
const allItems: any[] = []
|
||||||
|
|||||||
+7
-2
@@ -1,4 +1,9 @@
|
|||||||
import { BigNumberInput, OrderChangeDTO, OrderDTO } from "@medusajs/types"
|
import {
|
||||||
|
BigNumberInput,
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
WorkflowResponse,
|
WorkflowResponse,
|
||||||
@@ -43,7 +48,7 @@ export const createOrderEditShippingMethodWorkflow = createWorkflow(
|
|||||||
order_id: string
|
order_id: string
|
||||||
shipping_option_id: string
|
shipping_option_id: string
|
||||||
custom_price?: BigNumberInput
|
custom_price?: BigNumberInput
|
||||||
}): WorkflowResponse<OrderDTO> {
|
}): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
fields: ["id", "status", "currency_code", "canceled_at"],
|
fields: ["id", "status", "currency_code", "canceled_at"],
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
import {
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
|
OrderWorkflow,
|
||||||
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
WorkflowData,
|
WorkflowData,
|
||||||
@@ -33,15 +38,15 @@ export const orderEditAddNewItemValidationStep = createStep(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export const orderOrderEditAddNewItemWorkflowId = "order-edit-add-new-item"
|
export const orderEditAddNewItemWorkflowId = "order-edit-add-new-item"
|
||||||
/**
|
/**
|
||||||
* This workflow adds new items to an order edit.
|
* This workflow adds new items to an order edit.
|
||||||
*/
|
*/
|
||||||
export const orderOrderEditAddNewItemWorkflow = createWorkflow(
|
export const orderEditAddNewItemWorkflow = createWorkflow(
|
||||||
orderOrderEditAddNewItemWorkflowId,
|
orderEditAddNewItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.OrderEditAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.OrderEditAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
fields: ["id", "status", "canceled_at", "items.*"],
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -61,7 +62,7 @@ export const removeItemOrderEditActionWorkflow = createWorkflow(
|
|||||||
removeItemOrderEditActionWorkflowId,
|
removeItemOrderEditActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteOrderEditItemActionWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteOrderEditItemActionWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
fields: ["id", "status", "canceled_at", "items.*"],
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -58,7 +58,7 @@ export const removeOrderEditShippingMethodWorkflow = createWorkflow(
|
|||||||
removeOrderEditShippingMethodWorkflowId,
|
removeOrderEditShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteOrderEditShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteOrderEditShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_change",
|
entry_point: "order_change",
|
||||||
fields: ["id", "status", "version", "actions.*"],
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -64,7 +65,7 @@ export const updateOrderEditAddItemWorkflow = createWorkflow(
|
|||||||
updateOrderEditAddItemWorkflowId,
|
updateOrderEditAddItemWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateOrderEditAddNewItemWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateOrderEditAddNewItemWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const order: OrderDTO = useRemoteQueryStep({
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
entry_point: "orders",
|
entry_point: "orders",
|
||||||
fields: ["id", "status", "canceled_at", "items.*"],
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -60,7 +60,7 @@ export const updateOrderEditShippingMethodWorkflow = createWorkflow(
|
|||||||
updateOrderEditShippingMethodWorkflowId,
|
updateOrderEditShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateOrderEditShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateOrderEditShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
entry_point: "order_change",
|
entry_point: "order_change",
|
||||||
fields: ["id", "status", "version", "actions.*"],
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
|||||||
+4
-1
@@ -3,6 +3,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderReturnItemDTO,
|
OrderReturnItemDTO,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -134,7 +135,9 @@ export const confirmReturnReceiveWorkflowId = "confirm-return-receive"
|
|||||||
*/
|
*/
|
||||||
export const confirmReturnReceiveWorkflow = createWorkflow(
|
export const confirmReturnReceiveWorkflow = createWorkflow(
|
||||||
confirmReturnReceiveWorkflowId,
|
confirmReturnReceiveWorkflowId,
|
||||||
function (input: ConfirmReceiveReturnRequestWorkflowInput): WorkflowResponse<OrderDTO> {
|
function (
|
||||||
|
input: ConfirmReceiveReturnRequestWorkflowInput
|
||||||
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: [
|
fields: [
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
FulfillmentWorkflow,
|
FulfillmentWorkflow,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
@@ -137,7 +138,9 @@ export const confirmReturnRequestWorkflowId = "confirm-return-request"
|
|||||||
*/
|
*/
|
||||||
export const confirmReturnRequestWorkflow = createWorkflow(
|
export const confirmReturnRequestWorkflow = createWorkflow(
|
||||||
confirmReturnRequestWorkflowId,
|
confirmReturnRequestWorkflowId,
|
||||||
function (input: ConfirmReturnRequestWorkflowInput): WorkflowResponse<OrderDTO> {
|
function (
|
||||||
|
input: ConfirmReturnRequestWorkflowInput
|
||||||
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "location_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "location_id", "canceled_at"],
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import {
|
|||||||
BigNumberInput,
|
BigNumberInput,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
@@ -53,7 +54,7 @@ export const createReturnShippingMethodWorkflow = createWorkflow(
|
|||||||
exchange_id?: string
|
exchange_id?: string
|
||||||
shipping_option_id: string
|
shipping_option_id: string
|
||||||
custom_price?: BigNumberInput
|
custom_price?: BigNumberInput
|
||||||
}): WorkflowResponse<OrderDTO> {
|
}): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -55,7 +56,7 @@ export const dismissItemReturnRequestWorkflow = createWorkflow(
|
|||||||
dismissItemReturnRequestWorkflowId,
|
dismissItemReturnRequestWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.ReceiveOrderReturnItemsWorkflowInput>
|
input: WorkflowData<OrderWorkflow.ReceiveOrderReturnItemsWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at", "items.*"],
|
fields: ["id", "status", "order_id", "canceled_at", "items.*"],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -55,7 +56,7 @@ export const receiveItemReturnRequestWorkflow = createWorkflow(
|
|||||||
receiveItemReturnRequestWorkflowId,
|
receiveItemReturnRequestWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.ReceiveOrderReturnItemsWorkflowInput>
|
input: WorkflowData<OrderWorkflow.ReceiveOrderReturnItemsWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at", "items.*"],
|
fields: ["id", "status", "order_id", "canceled_at", "items.*"],
|
||||||
|
|||||||
+8
-2
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -72,7 +73,7 @@ export const removeItemReceiveReturnActionWorkflow = createWorkflow(
|
|||||||
removeItemReceiveReturnActionWorkflowId,
|
removeItemReceiveReturnActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteRequestItemReceiveReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteRequestItemReceiveReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -102,7 +103,12 @@ export const removeItemReceiveReturnActionWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeItemReceiveReturnActionValidationStep({ order, input, orderReturn, orderChange })
|
removeItemReceiveReturnActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderReturn,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -66,7 +67,7 @@ export const removeItemReturnActionWorkflow = createWorkflow(
|
|||||||
removeItemReturnActionWorkflowId,
|
removeItemReturnActionWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteRequestItemReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteRequestItemReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -106,7 +107,12 @@ export const removeItemReturnActionWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeReturnItemActionValidationStep({ order, input, orderReturn, orderChange })
|
removeReturnItemActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderReturn,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -65,7 +65,7 @@ export const removeReturnShippingMethodWorkflow = createWorkflow(
|
|||||||
removeReturnShippingMethodWorkflowId,
|
removeReturnShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.DeleteReturnShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.DeleteReturnShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -87,7 +87,11 @@ export const removeReturnShippingMethodWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
removeReturnShippingMethodValidationStep({ orderReturn, orderChange, input })
|
removeReturnShippingMethodValidationStep({
|
||||||
|
orderReturn,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
const dataToRemove = transform(
|
const dataToRemove = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -61,7 +62,7 @@ export const requestItemReturnWorkflow = createWorkflow(
|
|||||||
requestItemReturnWorkflowId,
|
requestItemReturnWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.RequestItemReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.RequestItemReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
+8
-2
@@ -2,6 +2,7 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -76,7 +77,7 @@ export const updateReceiveItemReturnRequestWorkflow = createWorkflow(
|
|||||||
updateReceiveItemReturnRequestWorkflowId,
|
updateReceiveItemReturnRequestWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateReceiveItemReturnRequestWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateReceiveItemReturnRequestWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -106,7 +107,12 @@ export const updateReceiveItemReturnRequestWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
updateReceiveItemReturnRequestValidationStep({ order, input, orderReturn, orderChange })
|
updateReceiveItemReturnRequestValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderReturn,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
const updateData = transform(
|
const updateData = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ import {
|
|||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { ChangeActionType, isDefined, OrderChangeStatus } from "@medusajs/utils"
|
import { ChangeActionType, OrderChangeStatus, isDefined } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
createStep,
|
createStep,
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
transform,
|
transform,
|
||||||
WorkflowData,
|
|
||||||
WorkflowResponse,
|
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
import { useRemoteQueryStep } from "../../../common"
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
import {
|
import {
|
||||||
@@ -81,7 +82,7 @@ export const updateRequestItemReturnWorkflow = createWorkflow(
|
|||||||
updateRequestItemReturnWorkflowId,
|
updateRequestItemReturnWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateRequestItemReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateRequestItemReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
@@ -111,7 +112,12 @@ export const updateRequestItemReturnWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
updateRequestItemReturnValidationStep({ order, input, orderReturn, orderChange })
|
updateRequestItemReturnValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderReturn,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
const updateData = transform(
|
const updateData = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeActionDTO,
|
OrderChangeActionDTO,
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -67,7 +67,7 @@ export const updateReturnShippingMethodWorkflow = createWorkflow(
|
|||||||
updateReturnShippingMethodWorkflowId,
|
updateReturnShippingMethodWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateReturnShippingMethodWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateReturnShippingMethodWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
OrderChangeDTO,
|
OrderChangeDTO,
|
||||||
OrderDTO,
|
OrderPreviewDTO,
|
||||||
OrderWorkflow,
|
OrderWorkflow,
|
||||||
ReturnDTO,
|
ReturnDTO,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -45,7 +45,7 @@ export const updateReturnWorkflow = createWorkflow(
|
|||||||
updateReturnWorkflowId,
|
updateReturnWorkflowId,
|
||||||
function (
|
function (
|
||||||
input: WorkflowData<OrderWorkflow.UpdateReturnWorkflowInput>
|
input: WorkflowData<OrderWorkflow.UpdateReturnWorkflowInput>
|
||||||
): WorkflowResponse<OrderDTO> {
|
): WorkflowResponse<OrderPreviewDTO> {
|
||||||
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
const orderReturn: ReturnDTO = useRemoteQueryStep({
|
||||||
entry_point: "return",
|
entry_point: "return",
|
||||||
fields: ["id", "status", "order_id", "canceled_at"],
|
fields: ["id", "status", "order_id", "canceled_at"],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OrderDTO } from "../../../order"
|
import { OrderDTO, OrderPreviewDTO } from "../../../order"
|
||||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||||
import { AdminReturn } from "../../return"
|
import { AdminReturn } from "../../return"
|
||||||
import { AdminClaim } from "./entities"
|
import { AdminClaim } from "./entities"
|
||||||
@@ -18,12 +18,12 @@ export interface AdminClaimOrderResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminClaimPreviewResponse {
|
export interface AdminClaimPreviewResponse {
|
||||||
order_preview: OrderDTO
|
order_preview: OrderPreviewDTO
|
||||||
claim: AdminClaim
|
claim: AdminClaim
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminClaimReturnPreviewResponse {
|
export interface AdminClaimReturnPreviewResponse {
|
||||||
order_preview: OrderDTO
|
order_preview: OrderPreviewDTO
|
||||||
return: AdminReturn
|
return: AdminReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { OrderDTO } from "../../../order";
|
import { OrderDTO, OrderPreviewDTO } from "../../../order"
|
||||||
import { PaginatedResponse } from "../../common";
|
import { PaginatedResponse } from "../../common"
|
||||||
import { AdminReturn } from "../../return";
|
import { AdminReturn } from "../../return"
|
||||||
import { AdminExchange } from "./entities";
|
import { AdminExchange } from "./entities"
|
||||||
|
|
||||||
export interface AdminExchangeResponse {
|
export interface AdminExchangeResponse {
|
||||||
exchange: AdminExchange
|
exchange: AdminExchange
|
||||||
@@ -17,15 +17,16 @@ export interface AdminExchangeOrderResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminExchangePreviewResponse {
|
export interface AdminExchangePreviewResponse {
|
||||||
order_preview: OrderDTO
|
order_preview: OrderPreviewDTO
|
||||||
exchange: AdminExchange
|
exchange: AdminExchange
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminExchangeRequestResponse extends AdminExchangePreviewResponse {
|
export interface AdminExchangeRequestResponse
|
||||||
|
extends AdminExchangePreviewResponse {
|
||||||
return: AdminReturn
|
return: AdminReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminExchangeReturnResponse {
|
export interface AdminExchangeReturnResponse {
|
||||||
order_preview: OrderDTO
|
order_preview: OrderPreviewDTO
|
||||||
return: AdminReturn
|
return: AdminReturn
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ export * from "./inventory-level"
|
|||||||
export * from "./invite"
|
export * from "./invite"
|
||||||
export * from "./notification"
|
export * from "./notification"
|
||||||
export * from "./order"
|
export * from "./order"
|
||||||
|
export * from "./order-edit"
|
||||||
export * from "./payment"
|
export * from "./payment"
|
||||||
export * from "./price-list"
|
export * from "./price-list"
|
||||||
export * from "./pricing"
|
export * from "./pricing"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./responses"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { OrderPreviewDTO } from "../../../order"
|
||||||
|
|
||||||
|
export interface AdminOrderEditPreviewResponse {
|
||||||
|
order_preview: OrderPreviewDTO
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export interface BaseOrderEditItem {
|
||||||
|
id: string
|
||||||
|
order_id: string
|
||||||
|
item_id: string
|
||||||
|
quantity: number
|
||||||
|
metadata?: Record<string, unknown>
|
||||||
|
created_at: string | null
|
||||||
|
updated_at: string | null
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./admin"
|
||||||
|
export * from "./common"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface BeginOrderOrderEditWorkflowInput {
|
export interface BeginorderEditWorkflowInput {
|
||||||
order_id: string
|
order_id: string
|
||||||
created_by?: string
|
created_by?: string
|
||||||
internal_note?: string
|
internal_note?: string
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
removeItemExchangeActionWorkflow,
|
removeItemExchangeActionWorkflow,
|
||||||
updateExchangeAddItemWorkflow,
|
updateExchangeAddItemWorkflow,
|
||||||
} from "@medusajs/core-flows"
|
} from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ContainerRegistrationKeys,
|
ContainerRegistrationKeys,
|
||||||
remoteQueryObjectFromString,
|
remoteQueryObjectFromString,
|
||||||
@@ -10,11 +11,10 @@ import {
|
|||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../../../../types/routing"
|
} from "../../../../../../../types/routing"
|
||||||
import { AdminPostExhangesItemsActionReqSchemaType } from "../../../../validators"
|
import { AdminPostExchangesItemsActionReqSchemaType } from "../../../../validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminPostExhangesItemsActionReqSchemaType>,
|
req: AuthenticatedMedusaRequest<AdminPostExchangesItemsActionReqSchemaType>,
|
||||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||||
) => {
|
) => {
|
||||||
const { id, action_id } = req.params
|
const { id, action_id } = req.params
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import {
|
|||||||
AdminGetOrdersParams,
|
AdminGetOrdersParams,
|
||||||
AdminPostCancelExchangeReqSchema,
|
AdminPostCancelExchangeReqSchema,
|
||||||
AdminPostExchangesAddItemsReqSchema,
|
AdminPostExchangesAddItemsReqSchema,
|
||||||
|
AdminPostExchangesItemsActionReqSchema,
|
||||||
AdminPostExchangesRequestItemsReturnActionReqSchema,
|
AdminPostExchangesRequestItemsReturnActionReqSchema,
|
||||||
AdminPostExchangesReturnRequestItemsReqSchema,
|
AdminPostExchangesReturnRequestItemsReqSchema,
|
||||||
AdminPostExchangesShippingActionReqSchema,
|
AdminPostExchangesShippingActionReqSchema,
|
||||||
AdminPostExchangesShippingReqSchema,
|
AdminPostExchangesShippingReqSchema,
|
||||||
AdminPostExhangesItemsActionReqSchema,
|
|
||||||
AdminPostOrderExchangesReqSchema,
|
AdminPostOrderExchangesReqSchema,
|
||||||
} from "./validators"
|
} from "./validators"
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
|||||||
method: ["POST"],
|
method: ["POST"],
|
||||||
matcher: "/admin/exchanges/:id/outbound/items/:action_id",
|
matcher: "/admin/exchanges/:id/outbound/items/:action_id",
|
||||||
middlewares: [
|
middlewares: [
|
||||||
validateAndTransformBody(AdminPostExhangesItemsActionReqSchema),
|
validateAndTransformBody(AdminPostExchangesItemsActionReqSchema),
|
||||||
validateAndTransformQuery(
|
validateAndTransformQuery(
|
||||||
AdminGetOrdersOrderParams,
|
AdminGetOrdersOrderParams,
|
||||||
QueryConfig.retrieveTransformQueryConfig
|
QueryConfig.retrieveTransformQueryConfig
|
||||||
|
|||||||
@@ -160,11 +160,11 @@ export type AdminPostExchangesConfirmRequestReqSchemaType = z.infer<
|
|||||||
typeof AdminPostExchangesConfirmRequestReqSchema
|
typeof AdminPostExchangesConfirmRequestReqSchema
|
||||||
>
|
>
|
||||||
|
|
||||||
export const AdminPostExhangesItemsActionReqSchema = z.object({
|
export const AdminPostExchangesItemsActionReqSchema = z.object({
|
||||||
quantity: z.number().optional(),
|
quantity: z.number().optional(),
|
||||||
internal_note: z.string().nullish().optional(),
|
internal_note: z.string().nullish().optional(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type AdminPostExhangesItemsActionReqSchemaType = z.infer<
|
export type AdminPostExchangesItemsActionReqSchemaType = z.infer<
|
||||||
typeof AdminPostExhangesItemsActionReqSchema
|
typeof AdminPostExchangesItemsActionReqSchema
|
||||||
>
|
>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { confirmOrderEditRequestWorkflow } 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 confirmOrderEditRequestWorkflow(req.scope).run({
|
||||||
|
input: { order_id: id },
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import {
|
||||||
|
removeItemOrderEditActionWorkflow,
|
||||||
|
updateOrderEditAddItemWorkflow,
|
||||||
|
} from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../../../../types/routing"
|
||||||
|
import { AdminPostOrderEditsItemsActionReqSchemaType } from "../../../validators"
|
||||||
|
|
||||||
|
export const POST = async (
|
||||||
|
req: AuthenticatedMedusaRequest<AdminPostOrderEditsItemsActionReqSchemaType>,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id, action_id } = req.params
|
||||||
|
|
||||||
|
const { result } = await updateOrderEditAddItemWorkflow(req.scope).run({
|
||||||
|
input: {
|
||||||
|
data: { ...req.validatedBody },
|
||||||
|
order_id: id,
|
||||||
|
action_id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DELETE = async (
|
||||||
|
req: AuthenticatedMedusaRequest,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id, action_id } = req.params
|
||||||
|
|
||||||
|
const { result: orderPreview } = await removeItemOrderEditActionWorkflow(
|
||||||
|
req.scope
|
||||||
|
).run({
|
||||||
|
input: {
|
||||||
|
order_id: id,
|
||||||
|
action_id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: orderPreview,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { orderEditAddNewItemWorkflow } from "@medusajs/core-flows"
|
||||||
|
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../../../types/routing"
|
||||||
|
import { AdminPostOrderEditsAddItemsReqSchemaType } from "../../validators"
|
||||||
|
|
||||||
|
export const POST = async (
|
||||||
|
req: AuthenticatedMedusaRequest<AdminPostOrderEditsAddItemsReqSchemaType>,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id } = req.params
|
||||||
|
|
||||||
|
const { result } = await orderEditAddNewItemWorkflow(req.scope).run({
|
||||||
|
input: { ...req.validatedBody, order_id: id },
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { cancelBeginOrderEditWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { DeleteResponse } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../../types/routing"
|
||||||
|
|
||||||
|
export const DELETE = async (
|
||||||
|
req: AuthenticatedMedusaRequest,
|
||||||
|
res: MedusaResponse<DeleteResponse<"order-edit">>
|
||||||
|
) => {
|
||||||
|
const { id } = req.params
|
||||||
|
|
||||||
|
await cancelBeginOrderEditWorkflow(req.scope).run({
|
||||||
|
input: {
|
||||||
|
order_id: id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
res.status(200).json({
|
||||||
|
id,
|
||||||
|
object: "order-edit",
|
||||||
|
deleted: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import {
|
||||||
|
removeOrderEditShippingMethodWorkflow,
|
||||||
|
updateOrderEditShippingMethodWorkflow,
|
||||||
|
} from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../../../../types/routing"
|
||||||
|
import { AdminPostOrderEditsShippingActionReqSchemaType } from "../../../validators"
|
||||||
|
|
||||||
|
export const POST = async (
|
||||||
|
req: AuthenticatedMedusaRequest<AdminPostOrderEditsShippingActionReqSchemaType>,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id, action_id } = req.params
|
||||||
|
|
||||||
|
const { result } = await updateOrderEditShippingMethodWorkflow(req.scope).run(
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
data: { ...req.validatedBody },
|
||||||
|
order_id: id,
|
||||||
|
action_id,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DELETE = async (
|
||||||
|
req: AuthenticatedMedusaRequest,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id, action_id } = req.params
|
||||||
|
|
||||||
|
const { result: orderPreview } = await removeOrderEditShippingMethodWorkflow(
|
||||||
|
req.scope
|
||||||
|
).run({
|
||||||
|
input: {
|
||||||
|
order_id: id,
|
||||||
|
action_id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: orderPreview,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { createOrderEditShippingMethodWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../../../types/routing"
|
||||||
|
import { AdminPostOrderEditsShippingReqSchemaType } from "../../validators"
|
||||||
|
|
||||||
|
export const POST = async (
|
||||||
|
req: AuthenticatedMedusaRequest<AdminPostOrderEditsShippingReqSchemaType>,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderEditPreviewResponse>
|
||||||
|
) => {
|
||||||
|
const { id } = req.params
|
||||||
|
|
||||||
|
const { result } = await createOrderEditShippingMethodWorkflow(req.scope).run(
|
||||||
|
{
|
||||||
|
input: { ...req.validatedBody, order_id: id },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order_preview: result,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import { MiddlewareRoute } from "@medusajs/framework"
|
||||||
|
import { validateAndTransformBody } from "../../utils/validate-body"
|
||||||
|
import {
|
||||||
|
AdminPostOrderEditsAddItemsReqSchema,
|
||||||
|
AdminPostOrderEditsItemsActionReqSchema,
|
||||||
|
AdminPostOrderEditsReqSchema,
|
||||||
|
AdminPostOrderEditsShippingActionReqSchema,
|
||||||
|
AdminPostOrderEditsShippingReqSchema,
|
||||||
|
} from "./validators"
|
||||||
|
|
||||||
|
export const adminOrderEditRoutesMiddlewares: MiddlewareRoute[] = [
|
||||||
|
{
|
||||||
|
method: ["GET"],
|
||||||
|
matcher: "/admin/order-edits/:id",
|
||||||
|
middlewares: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits",
|
||||||
|
middlewares: [validateAndTransformBody(AdminPostOrderEditsReqSchema)],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits/:id/items",
|
||||||
|
middlewares: [
|
||||||
|
validateAndTransformBody(AdminPostOrderEditsAddItemsReqSchema),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits/:id/items/:action_id",
|
||||||
|
middlewares: [
|
||||||
|
validateAndTransformBody(AdminPostOrderEditsItemsActionReqSchema),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["DELETE"],
|
||||||
|
matcher: "/admin/order-edits/:id/items/:action_id",
|
||||||
|
middlewares: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits/:id/shipping-method",
|
||||||
|
middlewares: [
|
||||||
|
validateAndTransformBody(AdminPostOrderEditsShippingReqSchema),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits/:id/shipping-method/:action_id",
|
||||||
|
middlewares: [
|
||||||
|
validateAndTransformBody(AdminPostOrderEditsShippingActionReqSchema),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["DELETE"],
|
||||||
|
matcher: "/admin/order-edits/:id/shipping-method/:action_id",
|
||||||
|
middlewares: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["POST"],
|
||||||
|
matcher: "/admin/order-edits/:id/confirm",
|
||||||
|
middlewares: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: ["DELETE"],
|
||||||
|
matcher: "/admin/order-edits/:id",
|
||||||
|
middlewares: [],
|
||||||
|
},
|
||||||
|
]
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export const defaultAdminOrderEditFields = [
|
||||||
|
"id",
|
||||||
|
"order_id",
|
||||||
|
"display_id",
|
||||||
|
"order_version",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
"canceled_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
export const defaultAdminDetailsOrderEditFields = [
|
||||||
|
...defaultAdminOrderEditFields,
|
||||||
|
]
|
||||||
|
|
||||||
|
export const retrieveTransformQueryConfig = {
|
||||||
|
defaultFields: defaultAdminDetailsOrderEditFields,
|
||||||
|
isList: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
export const listTransformQueryConfig = {
|
||||||
|
defaults: defaultAdminOrderEditFields,
|
||||||
|
defaultLimit: 20,
|
||||||
|
isList: true,
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { beginOrderEditOrderWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
ContainerRegistrationKeys,
|
||||||
|
remoteQueryObjectFromString,
|
||||||
|
} from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
AuthenticatedMedusaRequest,
|
||||||
|
MedusaResponse,
|
||||||
|
} from "../../../types/routing"
|
||||||
|
import { AdminPostOrderEditsReqSchemaType } from "./validators"
|
||||||
|
|
||||||
|
export const POST = async (
|
||||||
|
req: AuthenticatedMedusaRequest<AdminPostOrderEditsReqSchemaType>,
|
||||||
|
res: MedusaResponse<HttpTypes.AdminOrderResponse>
|
||||||
|
) => {
|
||||||
|
const input = req.validatedBody as AdminPostOrderEditsReqSchemaType
|
||||||
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
|
|
||||||
|
const workflow = beginOrderEditOrderWorkflow(req.scope)
|
||||||
|
const { result } = await workflow.run({
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
|
const queryObject = remoteQueryObjectFromString({
|
||||||
|
entryPoint: "order",
|
||||||
|
variables: {
|
||||||
|
id: result.order_id,
|
||||||
|
filters: {
|
||||||
|
...req.filterableFields,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fields: req.remoteQueryConfig.fields,
|
||||||
|
})
|
||||||
|
|
||||||
|
const [order] = await remoteQuery(queryObject)
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
order,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { z } from "zod"
|
||||||
|
|
||||||
|
export const AdminPostOrderEditsReqSchema = z.object({
|
||||||
|
order_id: z.string(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
internal_note: z.string().optional(),
|
||||||
|
metadata: z.record(z.unknown()).nullish(),
|
||||||
|
})
|
||||||
|
export type AdminPostOrderEditsReqSchemaType = z.infer<
|
||||||
|
typeof AdminPostOrderEditsReqSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export const AdminPostOrderEditsShippingReqSchema = z.object({
|
||||||
|
shipping_option_id: z.string(),
|
||||||
|
custom_price: z.number().optional(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
internal_note: z.string().optional(),
|
||||||
|
metadata: z.record(z.unknown()).optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export type AdminPostOrderEditsShippingReqSchemaType = z.infer<
|
||||||
|
typeof AdminPostOrderEditsShippingReqSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export const AdminPostOrderEditsShippingActionReqSchema = z.object({
|
||||||
|
custom_price: z.number().optional(),
|
||||||
|
internal_note: z.string().nullish().optional(),
|
||||||
|
metadata: z.record(z.unknown()).nullish().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export type AdminPostOrderEditsShippingActionReqSchemaType = z.infer<
|
||||||
|
typeof AdminPostOrderEditsShippingActionReqSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export const AdminPostOrderEditsAddItemsReqSchema = z.object({
|
||||||
|
items: z.array(
|
||||||
|
z.object({
|
||||||
|
variant_id: z.string(),
|
||||||
|
quantity: z.number(),
|
||||||
|
unit_price: z.number().optional(),
|
||||||
|
internal_note: z.string().optional(),
|
||||||
|
allow_backorder: z.boolean().optional(),
|
||||||
|
metadata: z.record(z.unknown()).optional(),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
|
export type AdminPostOrderEditsAddItemsReqSchemaType = z.infer<
|
||||||
|
typeof AdminPostOrderEditsAddItemsReqSchema
|
||||||
|
>
|
||||||
|
export const AdminPostOrderEditsItemsActionReqSchema = z.object({
|
||||||
|
quantity: z.number().optional(),
|
||||||
|
internal_note: z.string().nullish().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
export type AdminPostOrderEditsItemsActionReqSchemaType = z.infer<
|
||||||
|
typeof AdminPostOrderEditsItemsActionReqSchema
|
||||||
|
>
|
||||||
@@ -14,6 +14,7 @@ import { adminFulfillmentsRoutesMiddlewares } from "./admin/fulfillments/middlew
|
|||||||
import { adminInventoryRoutesMiddlewares } from "./admin/inventory-items/middlewares"
|
import { adminInventoryRoutesMiddlewares } from "./admin/inventory-items/middlewares"
|
||||||
import { adminInviteRoutesMiddlewares } from "./admin/invites/middlewares"
|
import { adminInviteRoutesMiddlewares } from "./admin/invites/middlewares"
|
||||||
import { adminNotificationRoutesMiddlewares } from "./admin/notifications/middlewares"
|
import { adminNotificationRoutesMiddlewares } from "./admin/notifications/middlewares"
|
||||||
|
import { adminOrderEditRoutesMiddlewares } from "./admin/order-edits/middlewares"
|
||||||
import { adminOrderRoutesMiddlewares } from "./admin/orders/middlewares"
|
import { adminOrderRoutesMiddlewares } from "./admin/orders/middlewares"
|
||||||
import { adminPaymentRoutesMiddlewares } from "./admin/payments/middlewares"
|
import { adminPaymentRoutesMiddlewares } from "./admin/payments/middlewares"
|
||||||
import { adminPriceListsRoutesMiddlewares } from "./admin/price-lists/middlewares"
|
import { adminPriceListsRoutesMiddlewares } from "./admin/price-lists/middlewares"
|
||||||
@@ -112,4 +113,5 @@ export default defineMiddlewares([
|
|||||||
...adminRefundReasonsRoutesMiddlewares,
|
...adminRefundReasonsRoutesMiddlewares,
|
||||||
...adminExchangeRoutesMiddlewares,
|
...adminExchangeRoutesMiddlewares,
|
||||||
...adminProductVariantRoutesMiddlewares,
|
...adminProductVariantRoutesMiddlewares,
|
||||||
|
...adminOrderEditRoutesMiddlewares,
|
||||||
])
|
])
|
||||||
Reference in new issue
Block a user