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