feat(store): add id filtering to store collections endpoint (#13555)

* feat(store): add id filtering to store collections endpoint

* 🐛 Fix circular type reference

*  Add changeset
This commit is contained in:
Bastien
2025-09-23 10:37:32 -04:00
committed by GitHub
parent e074050e97
commit 513b352da3
5 changed files with 14 additions and 7 deletions
@@ -0,0 +1,5 @@
---
"@medusajs/types": patch
---
fix(types): resolve circular type reference in StoreCollectionListParams interface
+2 -2
View File
@@ -184,7 +184,7 @@ export class Store {
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations). * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
*/ */
list: async ( list: async (
query?: FindParams & HttpTypes.StoreCollectionFilters, query?: FindParams & HttpTypes.StoreCollectionListParams,
headers?: ClientHeaders headers?: ClientHeaders
) => { ) => {
return this.client.fetch<HttpTypes.StoreCollectionListResponse>( return this.client.fetch<HttpTypes.StoreCollectionListResponse>(
@@ -478,7 +478,7 @@ export class Store {
/** /**
* Related guides: [How to implement carts in the storefront](https://docs.medusajs.com/resources/storefront-development/cart). * Related guides: [How to implement carts in the storefront](https://docs.medusajs.com/resources/storefront-development/cart).
* *
* @tags cart * @tags cart
*/ */
public cart = { public cart = {
@@ -1,5 +1,6 @@
import { BaseCollectionListParams } from "../common" import { BaseCollectionListParams, BaseCollectionParams } from "../common"
export interface StoreCollectionFilters export interface StoreCollectionListParams
extends Omit<BaseCollectionListParams, "id"> { extends Omit<BaseCollectionListParams, "deleted_at"> {}
}
export interface StoreCollectionParams extends BaseCollectionParams {}
@@ -10,7 +10,7 @@ import {
} from "@medusajs/framework/utils" } from "@medusajs/framework/utils"
export const GET = async ( export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.StoreCollectionFilters>, req: AuthenticatedMedusaRequest<HttpTypes.StoreCollectionListParams>,
res: MedusaResponse<HttpTypes.StoreCollectionListResponse> res: MedusaResponse<HttpTypes.StoreCollectionListResponse>
) => { ) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
@@ -10,6 +10,7 @@ export const StoreGetCollectionParams = createSelectParams()
export const StoreGetCollectionsParamsFields = z.object({ export const StoreGetCollectionsParamsFields = z.object({
q: z.string().optional(), q: z.string().optional(),
id: z.union([z.string(), z.array(z.string())]).optional(),
title: z.union([z.string(), z.array(z.string())]).optional(), title: z.union([z.string(), z.array(z.string())]).optional(),
handle: z.union([z.string(), z.array(z.string())]).optional(), handle: z.union([z.string(), z.array(z.string())]).optional(),
created_at: createOperatorMap().optional(), created_at: createOperatorMap().optional(),