feat(core-flows,dashboard,medusa): ability to add and remove items to claim inbound (#8480)
* wip: setup UI * wip: rendering modal, adding claim items, create checks * fix: make form work after merge * fix: continuation of claim edit * chore: ability to add and remove items to claim inbound * chore: minor fixes --------- Co-authored-by: fPolic <mainacc.polic@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../../../../../types/routing"
|
||||
import { refetchEntity } from "../../../../../../utils/refetch-entity"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostReturnsRequestItemsActionReqSchemaType } from "../../../../../returns/validators"
|
||||
|
||||
@@ -64,30 +65,28 @@ export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
const { id, action_id } = req.params
|
||||
|
||||
const claim = await refetchEntity("order_claim", id, req.scope, ["return_id"])
|
||||
|
||||
const { result: orderPreview } = await removeItemReturnActionWorkflow(
|
||||
req.scope
|
||||
).run({
|
||||
input: {
|
||||
return_id: id,
|
||||
return_id: claim.return_id,
|
||||
action_id,
|
||||
},
|
||||
})
|
||||
|
||||
const queryObject = remoteQueryObjectFromString({
|
||||
entryPoint: "return",
|
||||
variables: {
|
||||
const orderReturn = await refetchEntity(
|
||||
"return",
|
||||
{
|
||||
...req.filterableFields,
|
||||
id,
|
||||
filters: {
|
||||
...req.filterableFields,
|
||||
},
|
||||
},
|
||||
fields: req.remoteQueryConfig.fields,
|
||||
})
|
||||
const [orderReturn] = await remoteQuery(queryObject)
|
||||
req.scope,
|
||||
defaultAdminDetailsReturnFields
|
||||
)
|
||||
|
||||
res.json({
|
||||
order_preview: orderPreview,
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
removeReturnShippingMethodWorkflow,
|
||||
removeClaimShippingMethodWorkflow,
|
||||
updateReturnShippingMethodWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import {
|
||||
@@ -76,7 +76,7 @@ export const DELETE = async (
|
||||
variables: {
|
||||
id,
|
||||
},
|
||||
fields: ["return_id"],
|
||||
fields: ["id", "return_id"],
|
||||
}),
|
||||
undefined,
|
||||
{
|
||||
@@ -84,11 +84,11 @@ export const DELETE = async (
|
||||
}
|
||||
)
|
||||
|
||||
const { result: orderPreview } = await removeReturnShippingMethodWorkflow(
|
||||
const { result: orderPreview } = await removeClaimShippingMethodWorkflow(
|
||||
req.scope
|
||||
).run({
|
||||
input: {
|
||||
return_id: claim.return_id,
|
||||
claim_id: claim.id,
|
||||
action_id,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user