From 8b0c84b2ea67aa65a19f85b539d3e518bacd1aaf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 9 Oct 2024 10:32:39 +0200 Subject: [PATCH] In memory filters --- packages/backend-core/src/users/users.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/backend-core/src/users/users.ts b/packages/backend-core/src/users/users.ts index d8546afa8b..96fb79c0d0 100644 --- a/packages/backend-core/src/users/users.ts +++ b/packages/backend-core/src/users/users.ts @@ -24,6 +24,7 @@ import * as context from "../context" import { getGlobalDB } from "../context" import { isCreator } from "./utils" import { UserDB } from "./db" +import { dataFilters } from "@budibase/shared-core" type GetOpts = { cleanup?: boolean } @@ -263,9 +264,12 @@ export async function paginatedUsers({ cleanup: true, }) } else { - // no search, query allDocs - const response = await db.allDocs(getGlobalUserParams(null, opts)) - userList = response.rows.map((row: any) => row.doc) + const response = await db.allDocs(getGlobalUserParams(null, opts)) + userList = response.rows.map(row => row.doc!) + + if (query) { + userList = dataFilters.search(userList, { query }).rows + } } return pagination(userList, pageSize, { paginate: true,