feat(utils): Support free text configuration (#6942)
**What** - Add support for searchable entity properties to configure default free text search when providing a `q` filter - `@Searchable` decorator to mark a property or relation to be searchable form the current entity FIXES CORE-1910
This commit is contained in:
@@ -234,6 +234,31 @@ moduleIntegrationTestRunner({
|
||||
})
|
||||
|
||||
describe("list", () => {
|
||||
it("should list all product that match the free text search", async () => {
|
||||
const data = buildProductOnlyData({
|
||||
title: "test product",
|
||||
})
|
||||
const data2 = buildProductOnlyData({
|
||||
title: "space X",
|
||||
})
|
||||
|
||||
const products = await service.create([data, data2])
|
||||
|
||||
const result = await service.list({
|
||||
q: "test",
|
||||
})
|
||||
|
||||
expect(result).toHaveLength(1)
|
||||
expect(result[0].title).toEqual("test product")
|
||||
|
||||
const result2 = await service.list({
|
||||
q: "space",
|
||||
})
|
||||
|
||||
expect(result2).toHaveLength(1)
|
||||
expect(result2[0].title).toEqual("space X")
|
||||
})
|
||||
|
||||
describe("soft deleted", function () {
|
||||
let product
|
||||
|
||||
|
||||
Reference in New Issue
Block a user