1
0
Fork 0
mirror of synced 2024-06-30 03:50:37 +12:00

Updating roles API further so find API works too.

This commit is contained in:
mike12345567 2021-05-17 14:28:41 +01:00
parent 19b1310c60
commit cbc2066d91

View file

@ -1,5 +1,6 @@
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 => {
// 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 => {
const appId = ctx.params.appId
const db = new CouchDB(appId)
const app = await db.get(DocumentTypes.APP_METADATA)
ctx.body = {
roles: await getAllRoles(appId),
name: app.name,
version: app.version,
url: app.url,
}
}