fix(medusa, types): fix more query types (#8907)
Fix issues / missing query types I didn't pick up in the previous PRs.
This commit is contained in:
@@ -3,15 +3,15 @@ import { FindParams } from "../../common"
|
|||||||
import {
|
import {
|
||||||
BasePaymentCollectionFilters,
|
BasePaymentCollectionFilters,
|
||||||
BasePaymentFilters,
|
BasePaymentFilters,
|
||||||
BasePaymentProviderFilters,
|
|
||||||
BasePaymentSessionFilters,
|
BasePaymentSessionFilters,
|
||||||
} from "../common"
|
} from "../common"
|
||||||
import { AdminRefund, AdminRefundReason } from "./entities"
|
import { AdminRefundReason } from "./entities"
|
||||||
|
|
||||||
export interface AdminPaymentProviderFilters
|
export interface AdminPaymentProviderFilters extends
|
||||||
extends BasePaymentProviderFilters {
|
FindParams, BaseFilterable<AdminPaymentProviderFilters>{
|
||||||
is_enabled?: boolean
|
id: string | string[]
|
||||||
}
|
is_enabled?: boolean
|
||||||
|
}
|
||||||
export interface AdminPaymentCollectionFilters
|
export interface AdminPaymentCollectionFilters
|
||||||
extends BasePaymentCollectionFilters {}
|
extends BasePaymentCollectionFilters {}
|
||||||
export interface AdminPaymentSessionFilters extends BasePaymentSessionFilters {}
|
export interface AdminPaymentSessionFilters extends BasePaymentSessionFilters {}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
BaseProductOptionParams,
|
BaseProductOptionParams,
|
||||||
} from "../common"
|
} from "../common"
|
||||||
|
|
||||||
export interface AdminProductOptionParams extends BaseProductOptionParams {}
|
export interface AdminProductOptionParams extends Omit<BaseProductOptionParams, "product_id"> {}
|
||||||
export interface AdminProductVariantParams extends
|
export interface AdminProductVariantParams extends
|
||||||
FindParams, BaseFilterable<AdminProductVariantParams> {
|
FindParams, BaseFilterable<AdminProductVariantParams> {
|
||||||
q?: string
|
q?: string
|
||||||
@@ -16,7 +16,7 @@ export interface AdminProductVariantParams extends
|
|||||||
updated_at?: OperatorMap<string>
|
updated_at?: OperatorMap<string>
|
||||||
deleted_at?: OperatorMap<string>
|
deleted_at?: OperatorMap<string>
|
||||||
}
|
}
|
||||||
export interface AdminProductListParams extends BaseProductListParams {
|
export interface AdminProductListParams extends Omit<BaseProductListParams, "categories"> {
|
||||||
price_list_id?: string | string[]
|
price_list_id?: string | string[]
|
||||||
variants?: AdminProductVariantParams
|
variants?: AdminProductVariantParams
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export interface AdminTaxRateListParams extends
|
|||||||
FindParams, BaseFilterable<AdminTaxRateListParams> {
|
FindParams, BaseFilterable<AdminTaxRateListParams> {
|
||||||
q?: string
|
q?: string
|
||||||
tax_region_id?: string | string[] | OperatorMap<string | string[]>
|
tax_region_id?: string | string[] | OperatorMap<string | string[]>
|
||||||
is_default?: string
|
is_default?: "true" | "false"
|
||||||
service_zone_id?: string
|
service_zone_id?: string
|
||||||
shipping_profile_id?: string
|
shipping_profile_id?: string
|
||||||
provider_id?: string
|
provider_id?: string
|
||||||
|
|||||||
@@ -28,11 +28,20 @@ export const AdminGetOrdersParams = createFindParams({
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
}).merge(
|
}).merge(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.union([z.string(), z.array(z.string())]).optional(),
|
id: z
|
||||||
status: z.union([z.string(), z.array(z.string())]).optional(),
|
.union([z.string(), z.array(z.string()), createOperatorMap()])
|
||||||
|
.optional(),
|
||||||
|
status: z
|
||||||
|
.union([z.string(), z.array(z.string()), createOperatorMap()])
|
||||||
|
.optional(),
|
||||||
|
name: z.union([z.string(), z.array(z.string())]).optional(),
|
||||||
|
sales_channel_id: z.array(z.string()).optional(),
|
||||||
|
fulfillment_status: z.array(z.string()).optional(),
|
||||||
|
payment_status: z.array(z.string()).optional(),
|
||||||
|
region_id: z.array(z.string()).optional(),
|
||||||
|
q: z.string().optional(),
|
||||||
created_at: createOperatorMap().optional(),
|
created_at: createOperatorMap().optional(),
|
||||||
updated_at: createOperatorMap().optional(),
|
updated_at: createOperatorMap().optional(),
|
||||||
deleted_at: createOperatorMap().optional(),
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ import {
|
|||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../types/routing"
|
} from "../../../../types/routing"
|
||||||
import { AdminGetPaymentProvidersParamsType } from "../validators"
|
|
||||||
import {
|
import {
|
||||||
ContainerRegistrationKeys,
|
ContainerRegistrationKeys,
|
||||||
remoteQueryObjectFromString,
|
remoteQueryObjectFromString,
|
||||||
} from "@medusajs/utils"
|
} from "@medusajs/utils"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetPaymentProvidersParamsType>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminPaymentProviderFilters>,
|
||||||
res: MedusaResponse<HttpTypes.AdminPaymentProviderListResponse>
|
res: MedusaResponse<HttpTypes.AdminPaymentProviderListResponse>
|
||||||
) => {
|
) => {
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
} from "../../helpers"
|
} from "../../helpers"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminProductVariantParams>,
|
||||||
res: MedusaResponse<HttpTypes.AdminProductVariantListResponse>
|
res: MedusaResponse<HttpTypes.AdminProductVariantListResponse>
|
||||||
) => {
|
) => {
|
||||||
const productId = req.params.id
|
const productId = req.params.id
|
||||||
|
|||||||
+1
-2
@@ -4,10 +4,9 @@ import {
|
|||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../../types/routing"
|
} from "../../../../../types/routing"
|
||||||
import { getRuleAttributesMap, validateRuleType } from "../../utils"
|
import { getRuleAttributesMap, validateRuleType } from "../../utils"
|
||||||
import { AdminGetPromotionRuleParamsType } from "../../validators"
|
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetPromotionRuleParamsType>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminGetPromotionRuleParams>,
|
||||||
res: MedusaResponse<HttpTypes.AdminRuleAttributeOptionsListResponse>
|
res: MedusaResponse<HttpTypes.AdminRuleAttributeOptionsListResponse>
|
||||||
) => {
|
) => {
|
||||||
const { rule_type: ruleType } = req.params
|
const { rule_type: ruleType } = req.params
|
||||||
|
|||||||
@@ -9,13 +9,9 @@ import {
|
|||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { refetchShippingProfile } from "./helpers"
|
import { refetchShippingProfile } from "./helpers"
|
||||||
import {
|
|
||||||
AdminCreateShippingProfileType,
|
|
||||||
AdminGetShippingProfilesParamsType,
|
|
||||||
} from "./validators"
|
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateShippingProfileType>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreateShippingProfile>,
|
||||||
res: MedusaResponse<HttpTypes.AdminShippingProfileResponse>
|
res: MedusaResponse<HttpTypes.AdminShippingProfileResponse>
|
||||||
) => {
|
) => {
|
||||||
const shippingProfilePayload = req.validatedBody
|
const shippingProfilePayload = req.validatedBody
|
||||||
@@ -34,7 +30,7 @@ export const POST = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetShippingProfilesParamsType>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminShippingProfileListParams>,
|
||||||
res: MedusaResponse<HttpTypes.AdminShippingProfileListResponse>
|
res: MedusaResponse<HttpTypes.AdminShippingProfileListResponse>
|
||||||
) => {
|
) => {
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
|
|||||||
Reference in New Issue
Block a user