feat(medusa,types,core-flows): apply created_by values - claims, exchanges, returns, fulfillment (#8712)
what: - Applies created_by values - claims, exchanges, returns, fulfillment RESOLVES CC-96
This commit is contained in:
@@ -1048,6 +1048,8 @@ medusaIntegrationTestRunner({
|
|||||||
)
|
)
|
||||||
).data.claim
|
).data.claim
|
||||||
|
|
||||||
|
expect(baseClaim.created_by).toEqual(expect.any(String))
|
||||||
|
|
||||||
await api.post(
|
await api.post(
|
||||||
`/admin/claims/${baseClaim.id}/inbound/items`,
|
`/admin/claims/${baseClaim.id}/inbound/items`,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,6 +392,8 @@ medusaIntegrationTestRunner({
|
|||||||
adminHeaders
|
adminHeaders
|
||||||
)
|
)
|
||||||
|
|
||||||
|
expect(result.data.exchange.created_by).toEqual(expect.any(String))
|
||||||
|
|
||||||
const exchangeId = result.data.exchange.id
|
const exchangeId = result.data.exchange.id
|
||||||
|
|
||||||
let r2 = await api.post(
|
let r2 = await api.post(
|
||||||
|
|||||||
@@ -311,6 +311,8 @@ medusaIntegrationTestRunner({
|
|||||||
adminHeaders
|
adminHeaders
|
||||||
)
|
)
|
||||||
|
|
||||||
|
expect(result.data.return.created_by).toEqual(expect.any(String))
|
||||||
|
|
||||||
let r2 = await api.post(
|
let r2 = await api.post(
|
||||||
"/admin/returns",
|
"/admin/returns",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ medusaIntegrationTestRunner({
|
|||||||
shipped_at: null,
|
shipped_at: null,
|
||||||
delivered_at: null,
|
delivered_at: null,
|
||||||
canceled_at: null,
|
canceled_at: null,
|
||||||
|
created_by: expect.any(String),
|
||||||
provider_id: "manual_test-provider",
|
provider_id: "manual_test-provider",
|
||||||
delivery_address: expect.objectContaining({
|
delivery_address: expect.objectContaining({
|
||||||
address_1: expect.any(String),
|
address_1: expect.any(String),
|
||||||
@@ -240,6 +241,7 @@ medusaIntegrationTestRunner({
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: fulfillment.id,
|
id: fulfillment.id,
|
||||||
shipped_at: expect.any(String),
|
shipped_at: expect.any(String),
|
||||||
|
marked_shipped_by: expect.any(String),
|
||||||
labels: [
|
labels: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: expect.any(String),
|
id: expect.any(String),
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export const beginClaimOrderWorkflow = createWorkflow(
|
|||||||
type: input.type,
|
type: input.type,
|
||||||
order_id: input.order_id,
|
order_id: input.order_id,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
|
created_by: input.created_by,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export const beginExchangeOrderWorkflow = createWorkflow(
|
|||||||
{
|
{
|
||||||
order_id: input.order_id,
|
order_id: input.order_id,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
|
created_by: input.created_by,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export const beginReturnOrderWorkflow = createWorkflow(
|
|||||||
order_id: input.order_id,
|
order_id: input.order_id,
|
||||||
location_id: input.location_id,
|
location_id: input.location_id,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
|
created_by: input.created_by,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ShippingOptionDTO } from "./shipping-option"
|
import { BaseFilterable, OperatorMap } from "../../dal"
|
||||||
import { FulfillmentProviderDTO } from "./fulfillment-provider"
|
|
||||||
import { FulfillmentAddressDTO } from "./address"
|
import { FulfillmentAddressDTO } from "./address"
|
||||||
import { FulfillmentItemDTO } from "./fulfillment-item"
|
import { FulfillmentItemDTO } from "./fulfillment-item"
|
||||||
import { FulfillmentLabelDTO } from "./fulfillment-label"
|
import { FulfillmentLabelDTO } from "./fulfillment-label"
|
||||||
import { BaseFilterable, OperatorMap } from "../../dal"
|
import { FulfillmentProviderDTO } from "./fulfillment-provider"
|
||||||
|
import { ShippingOptionDTO } from "./shipping-option"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fulfillment details.
|
* The fulfillment details.
|
||||||
@@ -39,6 +39,16 @@ export interface FulfillmentDTO {
|
|||||||
*/
|
*/
|
||||||
canceled_at: Date | null
|
canceled_at: Date | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that marked fulfillment as shipped
|
||||||
|
*/
|
||||||
|
marked_shipped_by?: string | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that created the fulfillment
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data necessary for the fulfillment provider to process
|
* The data necessary for the fulfillment provider to process
|
||||||
* the fulfillment.
|
* the fulfillment.
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ export interface CreateFulfillmentDTO {
|
|||||||
*/
|
*/
|
||||||
shipped_at?: Date | null
|
shipped_at?: Date | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that created the fulfillment
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date the fulfillment was delivered.
|
* The date the fulfillment was delivered.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1584,6 +1584,11 @@ export interface OrderClaimDTO
|
|||||||
* The refund amount of the claim.
|
* The refund amount of the claim.
|
||||||
*/
|
*/
|
||||||
refund_amount?: BigNumberValue
|
refund_amount?: BigNumberValue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the order claim
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1630,6 +1635,11 @@ export interface OrderExchangeDTO
|
|||||||
* The associated return's ID.
|
* The associated return's ID.
|
||||||
*/
|
*/
|
||||||
return_id?: string
|
return_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the order exchange
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -890,7 +890,7 @@ export interface CreateOrderChangeDTO {
|
|||||||
/**
|
/**
|
||||||
* The user that created the order change.
|
* The user that created the order change.
|
||||||
*/
|
*/
|
||||||
created_by?: string
|
created_by?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds custom data in key-value pairs.
|
* Holds custom data in key-value pairs.
|
||||||
@@ -1537,6 +1537,11 @@ export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
|||||||
* The associated exchange's ID.
|
* The associated exchange's ID.
|
||||||
*/
|
*/
|
||||||
exchange_id?: string
|
exchange_id?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the fulfillment
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1967,6 +1972,11 @@ export interface CreateOrderClaimDTO extends BaseOrderBundledActionsDTO {
|
|||||||
* on the claim.
|
* on the claim.
|
||||||
*/
|
*/
|
||||||
no_notification?: boolean
|
no_notification?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the order claim
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CancelOrderClaimDTO extends BaseOrderBundledActionsDTO {
|
export interface CancelOrderClaimDTO extends BaseOrderBundledActionsDTO {
|
||||||
@@ -2012,6 +2022,11 @@ export interface CreateOrderExchangeDTO extends BaseOrderBundledActionsDTO {
|
|||||||
* updates on the exchange.
|
* updates on the exchange.
|
||||||
*/
|
*/
|
||||||
no_notification?: boolean
|
no_notification?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the order exchange
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CancelOrderExchangeDTO extends BaseOrderBundledActionsDTO {
|
export interface CancelOrderExchangeDTO extends BaseOrderBundledActionsDTO {
|
||||||
|
|||||||
@@ -131,6 +131,11 @@ export type CreateFulfillmentWorkflowInput = {
|
|||||||
*/
|
*/
|
||||||
shipped_at?: Date | null
|
shipped_at?: Date | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that creates the fulfillment
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date the fulfillment was delivered.
|
* The date the fulfillment was delivered.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,4 +13,9 @@ export interface CreateShipmentWorkflowInput {
|
|||||||
* The labels associated with the fulfillment.
|
* The labels associated with the fulfillment.
|
||||||
*/
|
*/
|
||||||
labels: CreateFulfillmentLabelWorkflowDTO[]
|
labels: CreateFulfillmentLabelWorkflowDTO[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that marked fulfillment as shipped
|
||||||
|
*/
|
||||||
|
marked_shipped_by?: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ export interface UpdateFulfillmentWorkflowInput {
|
|||||||
*/
|
*/
|
||||||
shipped_at?: Date | null
|
shipped_at?: Date | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that marked fulfillment as shipped
|
||||||
|
*/
|
||||||
|
marked_shipped_by?: string | null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that created the fulfillment
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date the fulfillment was delivered.
|
* The date the fulfillment was delivered.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ import { OrderClaimType } from "../../order/mutations"
|
|||||||
export interface BeginOrderClaimWorkflowInput {
|
export interface BeginOrderClaimWorkflowInput {
|
||||||
type: OrderClaimType
|
type: OrderClaimType
|
||||||
order_id: string
|
order_id: string
|
||||||
created_by?: string
|
/**
|
||||||
|
* The id of the user that creates the order claim
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
internal_note?: string
|
internal_note?: string
|
||||||
description?: string
|
description?: string
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
export interface BeginOrderExchangeWorkflowInput {
|
export interface BeginOrderExchangeWorkflowInput {
|
||||||
order_id: string
|
order_id: string
|
||||||
created_by?: string
|
/**
|
||||||
|
* The id of the user that creates the order exchange
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
internal_note?: string
|
internal_note?: string
|
||||||
description?: string
|
description?: string
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
export interface BeginOrderReturnWorkflowInput {
|
export interface BeginOrderReturnWorkflowInput {
|
||||||
order_id: string
|
order_id: string
|
||||||
location_id?: string
|
location_id?: string
|
||||||
created_by?: string
|
/**
|
||||||
|
* The id of the user that creates the return
|
||||||
|
*/
|
||||||
|
created_by?: string | null
|
||||||
internal_note?: string
|
internal_note?: string
|
||||||
description?: string
|
description?: string
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export const defaultAdminClaimFields = [
|
|||||||
"display_id",
|
"display_id",
|
||||||
"order_version",
|
"order_version",
|
||||||
"refund_amount",
|
"refund_amount",
|
||||||
|
"created_by",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"canceled_at",
|
"canceled_at",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { beginClaimOrderWorkflow } from "@medusajs/core-flows"
|
import { beginClaimOrderWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ContainerRegistrationKeys,
|
ContainerRegistrationKeys,
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
@@ -10,7 +11,6 @@ import {
|
|||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { AdminPostOrderClaimsReqSchemaType } from "./validators"
|
import { AdminPostOrderClaimsReqSchemaType } from "./validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
@@ -43,7 +43,11 @@ export const POST = async (
|
|||||||
req: AuthenticatedMedusaRequest<AdminPostOrderClaimsReqSchemaType>,
|
req: AuthenticatedMedusaRequest<AdminPostOrderClaimsReqSchemaType>,
|
||||||
res: MedusaResponse<HttpTypes.AdminClaimOrderResponse>
|
res: MedusaResponse<HttpTypes.AdminClaimOrderResponse>
|
||||||
) => {
|
) => {
|
||||||
const input = req.validatedBody as AdminPostOrderClaimsReqSchemaType
|
const input = {
|
||||||
|
...req.validatedBody,
|
||||||
|
created_by: req.auth_context.actor_id,
|
||||||
|
}
|
||||||
|
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const defaultAdminExchangeFields = [
|
|||||||
"return_id",
|
"return_id",
|
||||||
"display_id",
|
"display_id",
|
||||||
"order_version",
|
"order_version",
|
||||||
|
"created_by",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"canceled_at",
|
"canceled_at",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { beginExchangeOrderWorkflow } from "@medusajs/core-flows"
|
import { beginExchangeOrderWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ContainerRegistrationKeys,
|
ContainerRegistrationKeys,
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
@@ -10,7 +11,6 @@ import {
|
|||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { AdminPostOrderExchangesReqSchemaType } from "./validators"
|
import { AdminPostOrderExchangesReqSchemaType } from "./validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
@@ -43,7 +43,11 @@ export const POST = async (
|
|||||||
req: AuthenticatedMedusaRequest<AdminPostOrderExchangesReqSchemaType>,
|
req: AuthenticatedMedusaRequest<AdminPostOrderExchangesReqSchemaType>,
|
||||||
res: MedusaResponse<HttpTypes.AdminExchangeOrderResponse>
|
res: MedusaResponse<HttpTypes.AdminExchangeOrderResponse>
|
||||||
) => {
|
) => {
|
||||||
const input = req.validatedBody as AdminPostOrderExchangesReqSchemaType
|
const input = {
|
||||||
|
...req.validatedBody,
|
||||||
|
created_by: req.auth_context.actor_id,
|
||||||
|
}
|
||||||
|
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { createShipmentWorkflow } from "@medusajs/core-flows"
|
import { createShipmentWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../../types/routing"
|
} from "../../../../../types/routing"
|
||||||
import { refetchFulfillment } from "../../helpers"
|
import { refetchFulfillment } from "../../helpers"
|
||||||
import { AdminCreateShipmentType } from "../../validators"
|
import { AdminCreateShipmentType } from "../../validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateShipmentType>,
|
req: AuthenticatedMedusaRequest<AdminCreateShipmentType>,
|
||||||
@@ -14,7 +14,11 @@ export const POST = async (
|
|||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|
||||||
await createShipmentWorkflow(req.scope).run({
|
await createShipmentWorkflow(req.scope).run({
|
||||||
input: { id, ...req.validatedBody },
|
input: {
|
||||||
|
...req.validatedBody,
|
||||||
|
id,
|
||||||
|
marked_shipped_by: req.auth_context.actor_id,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const fulfillment = await refetchFulfillment(
|
const fulfillment = await refetchFulfillment(
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ export const defaultAdminFulfillmentsFields = [
|
|||||||
"location_id",
|
"location_id",
|
||||||
"packed_at",
|
"packed_at",
|
||||||
"shipped_at",
|
"shipped_at",
|
||||||
|
"marked_shipped_by",
|
||||||
|
"created_by",
|
||||||
"delivered_at",
|
"delivered_at",
|
||||||
"canceled_at",
|
"canceled_at",
|
||||||
"data",
|
"data",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { createFulfillmentWorkflow } from "@medusajs/core-flows"
|
import { createFulfillmentWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { refetchFulfillment } from "./helpers"
|
import { refetchFulfillment } from "./helpers"
|
||||||
import { AdminCreateFulfillmentType } from "./validators"
|
import { AdminCreateFulfillmentType } from "./validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateFulfillmentType>,
|
req: AuthenticatedMedusaRequest<AdminCreateFulfillmentType>,
|
||||||
@@ -14,7 +14,10 @@ export const POST = async (
|
|||||||
const { result: fullfillment } = await createFulfillmentWorkflow(
|
const { result: fullfillment } = await createFulfillmentWorkflow(
|
||||||
req.scope
|
req.scope
|
||||||
).run({
|
).run({
|
||||||
input: req.validatedBody,
|
input: {
|
||||||
|
...req.validatedBody,
|
||||||
|
created_by: req.auth_context.actor_id,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const fulfillment = await refetchFulfillment(
|
const fulfillment = await refetchFulfillment(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const defaultAdminReturnFields = [
|
|||||||
"metadata",
|
"metadata",
|
||||||
"no_notification",
|
"no_notification",
|
||||||
"refund_amount",
|
"refund_amount",
|
||||||
|
"created_by",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"canceled_at",
|
"canceled_at",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { beginReturnOrderWorkflow } from "@medusajs/core-flows"
|
import { beginReturnOrderWorkflow } from "@medusajs/core-flows"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
ContainerRegistrationKeys,
|
ContainerRegistrationKeys,
|
||||||
ModuleRegistrationName,
|
ModuleRegistrationName,
|
||||||
@@ -10,7 +11,6 @@ import {
|
|||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { AdminPostReturnsReqSchemaType } from "./validators"
|
import { AdminPostReturnsReqSchemaType } from "./validators"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
@@ -43,7 +43,11 @@ export const POST = async (
|
|||||||
req: AuthenticatedMedusaRequest<AdminPostReturnsReqSchemaType>,
|
req: AuthenticatedMedusaRequest<AdminPostReturnsReqSchemaType>,
|
||||||
res: MedusaResponse<HttpTypes.AdminOrderReturnResponse>
|
res: MedusaResponse<HttpTypes.AdminOrderReturnResponse>
|
||||||
) => {
|
) => {
|
||||||
const input = req.validatedBody as AdminPostReturnsReqSchemaType
|
const input = {
|
||||||
|
...req.validatedBody,
|
||||||
|
created_by: req.auth_context.actor_id,
|
||||||
|
}
|
||||||
|
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
const orderModuleService = req.scope.resolve(ModuleRegistrationName.ORDER)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user