fix(types, medusa): fixes to http types and validators (#13928)
## Summary
**What** — What changes are introduced in this PR?
- Fix validators of delete item action for exchanges and claims to not include filter fields (their routes don't use these filters, and it doesn't make sense to have them)
- Fix query parameter type argument of the create reservation route to the correct HTTP type.
- Fix the HTTP type used for listing products and shipping options in the storefront to not include the `with_deleted` (It's also not supported by their validators)
**Why** — Why are these changes relevant or necessary?
*Please provide answer here*
**How** — How have these changes been implemented?
*Please provide answer here*
**Testing** — How have these changes been tested, or how can the reviewer test the feature?
*Please provide answer here*
---
## Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
```ts
// Example usage
```
---
## Checklist
Please ensure the following before requesting a review:
- [ ] I have added a **changeset** for this PR
- Every non-breaking change should be marked as a **patch**
- To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable
---
## Additional Context
Add any additional context, related issues, or references that might help the reviewer understand this PR.
This commit is contained in:
6
.changeset/fair-carrots-provide.md
Normal file
6
.changeset/fair-carrots-provide.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/types": patch
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
fix(types, medusa): fixes to http types and validators
|
||||
@@ -28,7 +28,7 @@ export interface StoreProductPricingContext {
|
||||
export interface StoreProductParams extends SelectParams, StoreProductPricingContext {}
|
||||
|
||||
export interface StoreProductListParams
|
||||
extends Omit<BaseProductListParams, "tags" | "status" | "categories" | "deleted_at">, StoreProductPricingContext {
|
||||
extends Omit<BaseProductListParams, "tags" | "status" | "categories" | "deleted_at" | "with_deleted">, StoreProductPricingContext {
|
||||
/**
|
||||
* Filter by the product's tag(s).
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ import { BaseFilterable } from "../../../dal"
|
||||
import { FindParams } from "../../common"
|
||||
|
||||
export interface StoreGetShippingOptionList
|
||||
extends FindParams,
|
||||
extends Omit<FindParams, "with_deleted">,
|
||||
BaseFilterable<StoreGetShippingOptionList> {
|
||||
/**
|
||||
* The ID of the cart to retrieve the shipping options that
|
||||
|
||||
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -62,7 +62,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimReturnPreviewResponse>
|
||||
) => {
|
||||
const { id, action_id } = req.params
|
||||
|
||||
@@ -65,7 +65,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimReturnPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminClaimActionsParams>,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminClaimPreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminGetOrdersParams,
|
||||
AdminPostCancelClaimReqSchema,
|
||||
@@ -77,7 +78,7 @@ export const adminClaimRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/claims/:id/claim-items/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -110,7 +111,7 @@ export const adminClaimRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/claims/:id/inbound/items/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -142,7 +143,7 @@ export const adminClaimRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/claims/:id/inbound/shipping-method/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -175,7 +176,7 @@ export const adminClaimRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/claims/:id/outbound/items/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -207,7 +208,7 @@ export const adminClaimRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/claims/:id/outbound/shipping-method/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteClaimItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
|
||||
@@ -209,3 +209,7 @@ export const AdminPostClaimsConfirmRequestReqSchema = z.object({
|
||||
export type AdminPostClaimsConfirmRequestReqSchemaType = z.infer<
|
||||
typeof AdminPostClaimsConfirmRequestReqSchema
|
||||
>
|
||||
|
||||
export const AdminDeleteClaimItemActionSchema = createSelectParams()
|
||||
|
||||
export type AdminDeleteClaimItemActionSchemaType = z.infer<typeof AdminDeleteClaimItemActionSchema>
|
||||
@@ -62,7 +62,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeReturnResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -65,7 +65,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangeReturnResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -51,7 +51,7 @@ export const POST = async (
|
||||
}
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminOrderExchangeListParams>,
|
||||
req: AuthenticatedMedusaRequest<{}, HttpTypes.SelectParams>,
|
||||
res: MedusaResponse<HttpTypes.AdminExchangePreviewResponse>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from "@medusajs/framework"
|
||||
import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminDeleteExchangeItemActionSchema,
|
||||
AdminGetExchangeParams,
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminGetOrdersParams,
|
||||
@@ -79,7 +80,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/exchanges/:id/inbound/items/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteExchangeItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -111,7 +112,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/exchanges/:id/inbound/shipping-method/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteExchangeItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -144,7 +145,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/exchanges/:id/outbound/items/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteExchangeItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
@@ -176,7 +177,7 @@ export const adminExchangeRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/exchanges/:id/outbound/shipping-method/:action_id",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminGetOrdersOrderParams,
|
||||
AdminDeleteExchangeItemActionSchema,
|
||||
QueryConfig.retrieveTransformQueryConfig
|
||||
),
|
||||
],
|
||||
|
||||
@@ -175,3 +175,9 @@ export const AdminPostExchangesItemsActionReqSchema = z.object({
|
||||
export type AdminPostExchangesItemsActionReqSchemaType = z.infer<
|
||||
typeof AdminPostExchangesItemsActionReqSchema
|
||||
>
|
||||
|
||||
export const AdminDeleteExchangeItemActionSchema = createSelectParams()
|
||||
|
||||
export type AdminDeleteExchangeItemActionSchemaType = z.infer<
|
||||
typeof AdminDeleteExchangeItemActionSchema
|
||||
>
|
||||
@@ -39,7 +39,7 @@ export const GET = async (
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<
|
||||
HttpTypes.AdminCreateReservation,
|
||||
HttpTypes.AdminGetReservationsParams
|
||||
HttpTypes.AdminReservationParams
|
||||
>,
|
||||
res: MedusaResponse<HttpTypes.AdminReservationResponse>
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user