Fix limit issues

This commit is contained in:
Adria Navarro 2024-10-09 10:44:04 +02:00
parent 3cf96c589c
commit d811b9527f
1 changed files with 8 additions and 4 deletions

View File

@ -263,13 +263,17 @@ export async function paginatedUsers({
userList = await bulkGetGlobalUsersById(query?.oneOf?._id, {
cleanup: true,
})
} else if (query) {
// TODO: this should use SQS search, but the logic is built in the 'server' package. Using the in-memory filtering to get this working meanwhile
const response = await db.allDocs<User>(
getGlobalUserParams(null, { ...opts, limit: undefined })
)
userList = response.rows.map(row => row.doc!)
userList = dataFilters.search(userList, { query, limit: opts.limit }).rows
} else {
// no search, query allDocs
const response = await db.allDocs<User>(getGlobalUserParams(null, opts))
userList = response.rows.map(row => row.doc!)
if (query) {
userList = dataFilters.search(userList, { query }).rows
}
}
return pagination(userList, pageSize, {
paginate: true,