Fix bug with getting screen list in app definition

This commit is contained in:
Andrew Kingston 2020-12-04 14:02:58 +00:00
parent 883b3761d5
commit 175be609b9
1 changed files with 7 additions and 4 deletions

View File

@ -26,7 +26,10 @@ const {
downloadExtractComponentLibraries, downloadExtractComponentLibraries,
} = require("../../utilities/createAppPackage") } = require("../../utilities/createAppPackage")
const { BASE_LAYOUTS } = require("../../constants/layouts") const { BASE_LAYOUTS } = require("../../constants/layouts")
const { HOME_SCREEN, LOGIN_SCREEN } = require("../../constants/screens") const {
createHomeScreen,
createLoginScreen,
} = require("../../constants/screens")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")
const { recurseMustache } = require("../../utilities/mustache") const { recurseMustache } = require("../../utilities/mustache")
const { generateAssetCss } = require("../../utilities/builder/generateCss") const { generateAssetCss } = require("../../utilities/builder/generateCss")
@ -112,7 +115,7 @@ exports.fetchAppDefinition = async function(ctx) {
const layouts = await getLayouts(db) const layouts = await getLayouts(db)
const userRoleId = getUserRoleId(ctx) const userRoleId = getUserRoleId(ctx)
const accessController = new AccessController(ctx.params.appId) const accessController = new AccessController(ctx.params.appId)
const screens = accessController.checkScreensAccess( const screens = await accessController.checkScreensAccess(
await getScreens(db), await getScreens(db),
userRoleId userRoleId
) )
@ -218,11 +221,11 @@ const createEmptyAppPackage = async (ctx, app) => {
screensAndLayouts.push(recurseMustache(cloned, app)) screensAndLayouts.push(recurseMustache(cloned, app))
} }
const homeScreen = cloneDeep(HOME_SCREEN) const homeScreen = createHomeScreen(app)
homeScreen._id = generateScreenID() homeScreen._id = generateScreenID()
screensAndLayouts.push(homeScreen) screensAndLayouts.push(homeScreen)
const loginScreen = cloneDeep(LOGIN_SCREEN) const loginScreen = createLoginScreen(app)
loginScreen._id = generateScreenID() loginScreen._id = generateScreenID()
screensAndLayouts.push(loginScreen) screensAndLayouts.push(loginScreen)