In memory filters
This commit is contained in:
parent
0e24df2ddf
commit
8b0c84b2ea
|
@ -24,6 +24,7 @@ import * as context from "../context"
|
||||||
import { getGlobalDB } from "../context"
|
import { getGlobalDB } from "../context"
|
||||||
import { isCreator } from "./utils"
|
import { isCreator } from "./utils"
|
||||||
import { UserDB } from "./db"
|
import { UserDB } from "./db"
|
||||||
|
import { dataFilters } from "@budibase/shared-core"
|
||||||
|
|
||||||
type GetOpts = { cleanup?: boolean }
|
type GetOpts = { cleanup?: boolean }
|
||||||
|
|
||||||
|
@ -263,9 +264,12 @@ export async function paginatedUsers({
|
||||||
cleanup: true,
|
cleanup: true,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// no search, query allDocs
|
const response = await db.allDocs<User>(getGlobalUserParams(null, opts))
|
||||||
const response = await db.allDocs(getGlobalUserParams(null, opts))
|
userList = response.rows.map(row => row.doc!)
|
||||||
userList = response.rows.map((row: any) => row.doc)
|
|
||||||
|
if (query) {
|
||||||
|
userList = dataFilters.search(userList, { query }).rows
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pagination(userList, pageSize, {
|
return pagination(userList, pageSize, {
|
||||||
paginate: true,
|
paginate: true,
|
||||||
|
|
Loading…
Reference in New Issue