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:
@@ -85,6 +85,43 @@ medusaIntegrationTestRunner({
|
||||
expect(listedApiKeys.data.api_keys).toHaveLength(0)
|
||||
})
|
||||
|
||||
it("should allow searching for api keys", async () => {
|
||||
await api.post(
|
||||
`/admin/api-keys`,
|
||||
{
|
||||
title: "Test Secret Key",
|
||||
type: ApiKeyType.SECRET,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
await api.post(
|
||||
`/admin/api-keys`,
|
||||
{
|
||||
title: "Test Publishable Key",
|
||||
type: ApiKeyType.PUBLISHABLE,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const listedSecretKeys = await api.get(
|
||||
`/admin/api-keys?q=Secret`,
|
||||
adminHeaders
|
||||
)
|
||||
const listedPublishableKeys = await api.get(
|
||||
`/admin/api-keys?q=Publish`,
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
expect(listedSecretKeys.data.api_keys).toHaveLength(1)
|
||||
expect(listedSecretKeys.data.api_keys[0].title).toEqual(
|
||||
"Test Secret Key"
|
||||
)
|
||||
expect(listedPublishableKeys.data.api_keys).toHaveLength(1)
|
||||
expect(listedPublishableKeys.data.api_keys[0].title).toEqual(
|
||||
"Test Publishable Key"
|
||||
)
|
||||
})
|
||||
|
||||
it("can use a secret api key for authentication", async () => {
|
||||
const created = await api.post(
|
||||
`/admin/api-keys`,
|
||||
|
||||
Reference in New Issue
Block a user