Updating roles API further so find API works too.

This commit is contained in:
mike12345567 2021-05-17 14:28:41 +01:00
parent 17504443df
commit e51afc7451
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
const { getAllRoles } = require("@budibase/auth/roles") const { getAllRoles } = require("@budibase/auth/roles")
const { getAllApps, getDeployedAppID } = require("@budibase/auth/db") const { getAllApps, getDeployedAppID, DocumentTypes } = require("@budibase/auth/db")
const CouchDB = require("../../../db")
exports.fetch = async ctx => { exports.fetch = async ctx => {
// always use the dev apps as they'll be most up to date (true) // always use the dev apps as they'll be most up to date (true)
@ -25,7 +26,12 @@ exports.fetch = async ctx => {
exports.find = async ctx => { exports.find = async ctx => {
const appId = ctx.params.appId const appId = ctx.params.appId
const db = new CouchDB(appId)
const app = await db.get(DocumentTypes.APP_METADATA)
ctx.body = { ctx.body = {
roles: await getAllRoles(appId), roles: await getAllRoles(appId),
name: app.name,
version: app.version,
url: app.url,
} }
} }