query optimisation on checklist endpoint

This commit is contained in:
Martin McKeaveney 2022-05-22 18:51:13 +01:00
parent 8ab3fc810b
commit 7299863d28
1 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
const { const {
generateConfigID, generateConfigID,
getConfigParams, getConfigParams,
getGlobalUserParams,
getScopedFullConfig, getScopedFullConfig,
getAllApps, getAllApps,
} = require("@budibase/backend-core/db") } = require("@budibase/backend-core/db")
@ -271,6 +272,14 @@ exports.configChecklist = async function (ctx) {
type: Configs.OIDC, type: Configs.OIDC,
}) })
// They have set up an global user
const users = await db.allDocs(
getGlobalUserParams(null, {
include_docs: true,
limit: 1,
})
)
ctx.body = { ctx.body = {
apps: { apps: {
checked: apps.length > 0, checked: apps.length > 0,
@ -283,7 +292,7 @@ exports.configChecklist = async function (ctx) {
link: "/builder/portal/manage/email", link: "/builder/portal/manage/email",
}, },
adminUser: { adminUser: {
checked: true, checked: users && users.rows.length >= 1,
label: "Create your first user", label: "Create your first user",
link: "/builder/portal/manage/users", link: "/builder/portal/manage/users",
}, },