|
|
|
@ -20,7 +20,7 @@ import { groups as groupUtils } from "@budibase/pro" |
|
|
|
|
|
|
|
const PAGE_LIMIT = 8 |
|
|
|
|
|
|
|
export const allUsers = async (newDb?: any) => { |
|
|
|
export const allUsers = async () => { |
|
|
|
const db = tenancy.getGlobalDB() |
|
|
|
const response = await db.allDocs( |
|
|
|
dbUtils.getGlobalUserParams(null, { |
|
|
|
@ -30,6 +30,15 @@ export const allUsers = async (newDb?: any) => { |
|
|
|
return response.rows.map((row: any) => row.doc) |
|
|
|
} |
|
|
|
|
|
|
|
export const countUsersByApp = async (appId: string) => { |
|
|
|
let response: any = await usersCore.searchGlobalUsersByApp(appId, { |
|
|
|
include_docs: true, |
|
|
|
}) |
|
|
|
return { |
|
|
|
userCount: response.length, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export const paginatedUsers = async ({ |
|
|
|
page, |
|
|
|
email, |
|
|
|
@ -56,7 +65,7 @@ export const paginatedUsers = async ({ |
|
|
|
userList = await usersCore.searchGlobalUsersByEmail(email, opts) |
|
|
|
property = "email" |
|
|
|
} else { |
|
|
|
// no search, query allDocs
|
|
|
|
// no search, query allDcso
|
|
|
|
const response = await db.allDocs(dbUtils.getGlobalUserParams(null, opts)) |
|
|
|
userList = response.rows.map((row: any) => row.doc) |
|
|
|
} |
|
|
|
|