diff --git a/packages/backend-core/src/users/users.ts b/packages/backend-core/src/users/users.ts index 7d62a6ef39..0c994d8287 100644 --- a/packages/backend-core/src/users/users.ts +++ b/packages/backend-core/src/users/users.ts @@ -18,9 +18,10 @@ import { CouchFindOptions, DatabaseQueryOpts, SearchFilters, - SearchFilterOperator, SearchUsersRequest, User, + BasicOperator, + ArrayOperator, } from "@budibase/types" import * as context from "../context" import { getGlobalDB } from "../context" @@ -46,9 +47,9 @@ function removeUserPassword(users: User | User[]) { export function isSupportedUserSearch(query: SearchFilters) { const allowed = [ - { op: SearchFilterOperator.STRING, key: "email" }, - { op: SearchFilterOperator.EQUAL, key: "_id" }, - { op: SearchFilterOperator.ONE_OF, key: "_id" }, + { op: BasicOperator.STRING, key: "email" }, + { op: BasicOperator.EQUAL, key: "_id" }, + { op: ArrayOperator.ONE_OF, key: "_id" }, ] for (let [key, operation] of Object.entries(query)) { if (typeof operation !== "object") { diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 43a6d39172..93ce912472 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -9,7 +9,6 @@ import { QuotaUsageType, Row, SaveTableRequest, - SearchFilterOperator, SortOrder, SortType, StaticQuotaName, @@ -19,6 +18,7 @@ import { ViewUIFieldMetadata, ViewV2, SearchResponse, + BasicOperator, } from "@budibase/types" import { generator, mocks } from "@budibase/backend-core/tests" import { DatabaseName, getDatasource } from "../../../integrations/tests/utils" @@ -149,7 +149,7 @@ describe.each([ primaryDisplay: "id", query: [ { - operator: SearchFilterOperator.EQUAL, + operator: BasicOperator.EQUAL, field: "field", value: "value", }, @@ -561,7 +561,7 @@ describe.each([ ...view, query: [ { - operator: SearchFilterOperator.EQUAL, + operator: BasicOperator.EQUAL, field: "newField", value: "thatValue", }, @@ -589,7 +589,7 @@ describe.each([ primaryDisplay: "Price", query: [ { - operator: SearchFilterOperator.EQUAL, + operator: BasicOperator.EQUAL, field: generator.word(), value: generator.word(), }, @@ -673,7 +673,7 @@ describe.each([ tableId: generator.guid(), query: [ { - operator: SearchFilterOperator.EQUAL, + operator: BasicOperator.EQUAL, field: "newField", value: "thatValue", }, @@ -1194,7 +1194,7 @@ describe.each([ name: generator.guid(), query: [ { - operator: SearchFilterOperator.EQUAL, + operator: BasicOperator.EQUAL, field: "two", value: "bar2", },