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 16:37:32 +02:00
committed by GitHub
parent e074050e97
commit 513b352da3
5 changed files with 14 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/types": patch
---
fix(types): resolve circular type reference in StoreCollectionListParams interface

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).
*/
list: async (
query?: FindParams & HttpTypes.StoreCollectionFilters,
query?: FindParams & HttpTypes.StoreCollectionListParams,
headers?: ClientHeaders
) => {
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).
*
*
* @tags cart
*/
public cart = {

View File

@@ -1,5 +1,6 @@
import { BaseCollectionListParams } from "../common"
import { BaseCollectionListParams, BaseCollectionParams } from "../common"
export interface StoreCollectionFilters
extends Omit<BaseCollectionListParams, "id"> {
}
export interface StoreCollectionListParams
extends Omit<BaseCollectionListParams, "deleted_at"> {}
export interface StoreCollectionParams extends BaseCollectionParams {}

View File

@@ -10,7 +10,7 @@ import {
} from "@medusajs/framework/utils"
export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.StoreCollectionFilters>,
req: AuthenticatedMedusaRequest<HttpTypes.StoreCollectionListParams>,
res: MedusaResponse<HttpTypes.StoreCollectionListResponse>
) => {
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

View File

@@ -10,6 +10,7 @@ export const StoreGetCollectionParams = createSelectParams()
export const StoreGetCollectionsParamsFields = z.object({
q: z.string().optional(),
id: 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(),
created_at: createOperatorMap().optional(),