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:
5
.changeset/fix-collection-store-circular-type.md
Normal file
5
.changeset/fix-collection-store-circular-type.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/types": patch
|
||||
---
|
||||
|
||||
fix(types): resolve circular type reference in StoreCollectionListParams interface
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user