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:
@@ -130,6 +130,20 @@ medusaIntegrationTestRunner({
|
||||
)
|
||||
})
|
||||
|
||||
it("should support search on campaigns", async () => {
|
||||
const response = await api.get(
|
||||
`/admin/campaigns?q=ign%202`,
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.campaigns).toEqual([
|
||||
expect.objectContaining({
|
||||
name: "campaign 2",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("should get all campaigns and its count filtered", async () => {
|
||||
const response = await api.get(
|
||||
`/admin/campaigns?fields=name,created_at,budget.id`,
|
||||
|
||||
@@ -67,6 +67,38 @@ medusaIntegrationTestRunner({
|
||||
])
|
||||
})
|
||||
|
||||
it("should support search of promotions", async () => {
|
||||
await promotionModuleService.create([
|
||||
{
|
||||
code: "first",
|
||||
type: PromotionType.STANDARD,
|
||||
application_method: {
|
||||
type: "fixed",
|
||||
target_type: "order",
|
||||
value: 100,
|
||||
},
|
||||
},
|
||||
{
|
||||
code: "second",
|
||||
type: PromotionType.STANDARD,
|
||||
application_method: {
|
||||
type: "fixed",
|
||||
target_type: "order",
|
||||
value: 100,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const response = await api.get(`/admin/promotions?q=fir`, adminHeaders)
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.promotions).toEqual([
|
||||
expect.objectContaining({
|
||||
code: "first",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("should get all promotions and its count filtered", async () => {
|
||||
await promotionModuleService.create([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user