chore: fixes to http and request types for orders (1) (#13822)
This commit is contained in:
@@ -109,6 +109,10 @@ export interface AdminCreateClaim {
|
||||
* An internal note viewed by admin users only.
|
||||
*/
|
||||
internal_note?: string
|
||||
/**
|
||||
* The ID of the associated reason.
|
||||
*/
|
||||
reason_id?: string | null
|
||||
/**
|
||||
* Key-value pairs of custom data.
|
||||
*/
|
||||
@@ -116,13 +120,13 @@ export interface AdminCreateClaim {
|
||||
}
|
||||
|
||||
export interface AdminAddClaimItems extends AdminClaimAddItems {}
|
||||
export interface AdminUpdateClaimItem extends AdminClaimUpdateItem {}
|
||||
export interface AdminUpdateClaimItem extends Omit<AdminClaimUpdateItem, "description"> {}
|
||||
|
||||
export interface AdminAddClaimInboundItems extends AdminClaimAddItems {}
|
||||
export interface AdminUpdateClaimInboundItem extends AdminClaimUpdateItem {}
|
||||
|
||||
export interface AdminAddClaimOutboundItems extends AdminClaimAddItems {}
|
||||
export interface AdminUpdateClaimOutboundItem extends AdminClaimUpdateItem {}
|
||||
export interface AdminUpdateClaimOutboundItem extends Omit<AdminClaimUpdateItem, "description"> {}
|
||||
|
||||
export interface AdminClaimAddInboundShipping
|
||||
extends AdminClaimAddShippingMethod {}
|
||||
|
||||
@@ -6,10 +6,48 @@ export interface AdminClaimListParams
|
||||
extends BaseClaimListParams,
|
||||
BaseFilterable<AdminClaimListParams> { }
|
||||
|
||||
export interface AdminClaimParams extends SelectParams {
|
||||
export interface AdminClaimActionsParams extends SelectParams {
|
||||
/**
|
||||
* Filter by claim ID(s).
|
||||
*/
|
||||
id?: string | string[]
|
||||
/**
|
||||
* Filter by claim status(es).
|
||||
*/
|
||||
status?: string | string[]
|
||||
/**
|
||||
* Apply filters on the claim's creation date.
|
||||
*/
|
||||
created_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the claim's update date.
|
||||
*/
|
||||
updated_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the claim's deletion date.
|
||||
*/
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface AdminClaimParams extends SelectParams {
|
||||
/**
|
||||
* Filter by claim ID(s).
|
||||
*/
|
||||
id?: string | string[]
|
||||
/**
|
||||
* Filter by claim status(es).
|
||||
*/
|
||||
status?: string | string[]
|
||||
/**
|
||||
* Apply filters on the claim's creation date.
|
||||
*/
|
||||
created_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the claim's update date.
|
||||
*/
|
||||
updated_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the claim's deletion date.
|
||||
*/
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
@@ -1,36 +1,32 @@
|
||||
enum ExchangeReason {
|
||||
MISSING_ITEM = "missing_item",
|
||||
WRONG_ITEM = "wrong_item",
|
||||
PRODUCTION_FAILURE = "production_failure",
|
||||
OTHER = "other",
|
||||
}
|
||||
|
||||
interface AdminExchangeAddItems {
|
||||
export interface AdminAddExchangeOutboundItems {
|
||||
/**
|
||||
* The items to add to the exchange.
|
||||
*/
|
||||
items: {
|
||||
/**
|
||||
* If you're adding an inbound item, this is the ID of the order item returned.
|
||||
* If you're adding an outbound item, this is the ID of the variant to add.
|
||||
* The ID of the variant to add.
|
||||
*/
|
||||
id: string
|
||||
variant_id: string
|
||||
/**
|
||||
* The item's quantity.
|
||||
*/
|
||||
quantity: number
|
||||
/**
|
||||
* The reason the item is being returned / sent to the customer.
|
||||
* The item's unit price.
|
||||
*/
|
||||
reason?: ExchangeReason
|
||||
/**
|
||||
* The item's description.
|
||||
*/
|
||||
description?: string
|
||||
unit_price?: number
|
||||
/**
|
||||
* An internal note viewed by admin users only.
|
||||
*/
|
||||
internal_note?: string
|
||||
/**
|
||||
* Whether to allow backorder for the item.
|
||||
*/
|
||||
allow_backorder?: boolean
|
||||
/**
|
||||
* Key-value pairs of custom data.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
}[]
|
||||
}
|
||||
|
||||
@@ -111,13 +107,46 @@ export interface AdminCreateExchange {
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface AdminAddExchangeInboundItems extends AdminExchangeAddItems {}
|
||||
export interface AdminAddExchangeInboundItems {
|
||||
/**
|
||||
* The ID of the location the items are returned to.
|
||||
*/
|
||||
location_id?: string
|
||||
/**
|
||||
* The items to add to the exchange.
|
||||
*/
|
||||
items: {
|
||||
/**
|
||||
* The ID of the order item returned.
|
||||
*/
|
||||
id: string
|
||||
/**
|
||||
* The item's quantity.
|
||||
*/
|
||||
quantity: number
|
||||
/**
|
||||
* The description of why the item is being returned.
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* An internal note viewed by admin users only.
|
||||
*/
|
||||
internal_note?: string
|
||||
/**
|
||||
* The ID of the associated return reason.
|
||||
*/
|
||||
reason_id?: string
|
||||
/**
|
||||
* Key-value pairs of custom data.
|
||||
*/
|
||||
metadata?: Record<string, unknown>
|
||||
}[]
|
||||
}
|
||||
export interface AdminUpdateExchangeInboundItem
|
||||
extends AdminExchangeUpdateItem {}
|
||||
|
||||
export interface AdminAddExchangeOutboundItems extends AdminExchangeAddItems {}
|
||||
export interface AdminUpdateExchangeOutboundItem
|
||||
extends AdminExchangeUpdateItem {}
|
||||
extends Omit<AdminExchangeUpdateItem, "reason_id" | "description"> {}
|
||||
|
||||
export interface AdminExchangeAddInboundShipping
|
||||
extends AdminExchangeAddShippingMethod {}
|
||||
|
||||
@@ -1,11 +1,52 @@
|
||||
import { OperatorMap } from "../../../dal"
|
||||
import { SelectParams } from "../../common"
|
||||
import { FindParams, SelectParams } from "../../common"
|
||||
|
||||
export interface AdminExchangeListParams extends SelectParams {
|
||||
export interface AdminExchangeListParams extends FindParams {
|
||||
/**
|
||||
* Filter by exchange ID(s).
|
||||
*/
|
||||
id?: string | string[]
|
||||
/**
|
||||
* Filter by order ID(s) to get their associated exchanges.
|
||||
*/
|
||||
order_id?: string | string[]
|
||||
/**
|
||||
* Filter by exchange status(es).
|
||||
*/
|
||||
status?: string | string[]
|
||||
/**
|
||||
* Apply filters on the exchange's creation date.
|
||||
*/
|
||||
created_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the exchange's update date.
|
||||
*/
|
||||
updated_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the exchange's deletion date.
|
||||
*/
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface AdminOrderExchangeListParams extends SelectParams {
|
||||
/**
|
||||
* Filter by exchange ID(s).
|
||||
*/
|
||||
id?: string | string[]
|
||||
/**
|
||||
* Filter by exchange status(es).
|
||||
*/
|
||||
status?: string | string[]
|
||||
/**
|
||||
* Apply filters on the exchange's creation date.
|
||||
*/
|
||||
created_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the exchange's update date.
|
||||
*/
|
||||
updated_at?: OperatorMap<string>
|
||||
/**
|
||||
* Apply filters on the exchange's deletion date.
|
||||
*/
|
||||
deleted_at?: OperatorMap<string>
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsItemsActionReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsItemsActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminUpdateClaimItem,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
@@ -49,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -7,11 +7,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimItemsReqSchemaType } from "../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimItemsReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminAddClaimItems,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -12,10 +12,12 @@ import {
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsShippingActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminClaimUpdateInboundShipping,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
|
||||
@@ -11,10 +11,12 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsItemsActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsItemsActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminUpdateClaimOutboundItem,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
@@ -49,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -8,11 +8,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsAddItemsReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsAddItemsReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminAddClaimOutboundItems,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -10,11 +10,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsShippingActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminClaimUpdateOutboundShipping,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
@@ -49,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -7,11 +7,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostClaimsShippingReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostClaimsShippingReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminClaimAddOutboundShipping,
|
||||
HttpTypes.AdminClaimActionsParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { defaultAdminDetailsReturnFields } from "../../../returns/query-config"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimRequestResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -4,10 +4,10 @@ import {
|
||||
refetchEntity,
|
||||
} from "@medusajs/framework/http"
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import { AdminClaimResponse } from "@medusajs/framework/types"
|
||||
import { AdminClaimResponse, HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminClaimActionsParams>,
|
||||
res: MedusaResponse<AdminClaimResponse>
|
||||
) => {
|
||||
const claim = await refetchEntity({
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderClaimsReqSchemaType } from "./validators"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminClaimListParams>,
|
||||
@@ -40,7 +39,10 @@ export const GET = async (
|
||||
}
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostOrderClaimsReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminCreateClaim,
|
||||
HttpTypes.AdminClaimParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimOrderResponse>
|
||||
) => {
|
||||
const input = {
|
||||
|
||||
@@ -10,10 +10,12 @@ import {
|
||||
} from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../returns/query-config"
|
||||
import { AdminPostExchangesReturnRequestItemsReqSchemaType } from "../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesReturnRequestItemsReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminAddExchangeInboundItems,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeReturnResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -12,10 +12,12 @@ import {
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config"
|
||||
import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesShippingActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminExchangeUpdateInboundShipping,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
|
||||
@@ -11,10 +11,12 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesItemsActionReqSchemaType } from "../../../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesItemsActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminUpdateExchangeOutboundItem,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
@@ -49,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -8,11 +8,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesAddItemsReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesAddItemsReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminAddExchangeOutboundItems,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -10,11 +10,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesShippingActionReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminExchangeUpdateOutboundShipping,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
@@ -49,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminOrderExchangeListParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -7,11 +7,13 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostExchangesShippingReqSchemaType } from "../../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostExchangesShippingReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminExchangeAddOutboundShipping,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { defaultAdminDetailsReturnFields } from "../../../returns/query-config"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeRequestResponse>
|
||||
) => {
|
||||
const { id } = req.params
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AdminExchangeResponse } from "@medusajs/framework/types"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
import { MedusaError } from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
} from "@medusajs/framework/http"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminExchangeResponse>
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeResponse>
|
||||
) => {
|
||||
const exchange = await refetchEntity({
|
||||
entity: "order_exchange",
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminGetExchangeParams,
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminGetOrdersParams,
|
||||
AdminPostCancelExchangeReqSchema,
|
||||
@@ -33,7 +34,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/exchanges/:id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminGetExchangeParams,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "@medusajs/framework/http"
|
||||
import { AdminPostOrderExchangesReqSchemaType } from "./validators"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminExchangeListParams>,
|
||||
@@ -40,7 +39,10 @@ export const GET = async (
|
||||
}
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminPostOrderExchangesReqSchemaType>,
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminCreateExchange,
|
||||
HttpTypes.SelectParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeOrderResponse>
|
||||
) => {
|
||||
const input = {
|
||||
|
||||
@@ -5,6 +5,12 @@ import {
|
||||
createSelectParams,
|
||||
} from "../../utils/validators"
|
||||
|
||||
export const AdminGetExchangeParams = createSelectParams()
|
||||
|
||||
export type AdminGetExchangeParamsType = z.infer<
|
||||
typeof AdminGetExchangeParams
|
||||
>
|
||||
|
||||
export const AdminGetOrdersOrderParams = createSelectParams().merge(
|
||||
z.object({
|
||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
|
||||
Reference in New Issue
Block a user