feat: Add support for search to all endpoints (#7149)

* feat: Add search capability to api keys

* feat: Add support for searching to currency and customer endpoints

* fix: Clean up product search filters

* feat: Add search support to regions

* feat: Add search support to sales channels

* feat: Add search support to store module

* feat: Add search support to user module

* fix: Clean up inventory search

* feat: Add search support for payments

* fix: Add searchable attributes to stock location models

* feat: Add search support to tax

* feat: Add search support to promotions

* feat: Add search support for pricing, filtering cleanup

* fix: Further cleanups around search
This commit is contained in:
Stevche Radevski
2024-04-25 17:36:59 +02:00
committed by GitHub
parent d02905cefa
commit f03a822253
52 changed files with 640 additions and 64 deletions
@@ -162,6 +162,71 @@ medusaIntegrationTestRunner({
},
])
})
it("should support searching of price lists", async () => {
const priceSet = await createVariantPriceSet({
container: appContainer,
variantId: variant.id,
prices: [],
})
await pricingModule.createPriceLists([
{
title: "first price list",
description: "test price",
ends_at: new Date(),
starts_at: new Date(),
status: PriceListStatus.ACTIVE,
type: PriceListType.OVERRIDE,
prices: [
{
amount: 5000,
currency_code: "usd",
price_set_id: priceSet.id,
rules: {
region_id: region.id,
},
},
],
rules: {
customer_group_id: [customerGroup.id],
},
},
{
title: "second price list",
description: "second test",
ends_at: new Date(),
starts_at: new Date(),
status: PriceListStatus.ACTIVE,
type: PriceListType.OVERRIDE,
prices: [
{
amount: 5000,
currency_code: "usd",
price_set_id: priceSet.id,
rules: {
region_id: region.id,
},
},
],
rules: {
customer_group_id: [customerGroup.id],
},
},
])
let response = await api.get(
`/admin/price-lists?q=second`,
adminHeaders
)
expect(response.status).toEqual(200)
expect(response.data.price_lists).toEqual([
expect.objectContaining({
title: "second price list",
}),
])
})
})
describe("GET /admin/price-lists/:id", () => {