From c6beee73e5bff42fa86782c535d7084dea78dbf3 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Mon, 23 Mar 2020 12:47:31 +0000 Subject: [PATCH] backend - getting create instance to work --- packages/builder/src/builderStore/store/index.js | 1 + packages/builder/src/common/core.js | 1 + packages/builder/src/database/ModelDataTable/api.js | 2 +- .../src/database/ModelDataTable/modals/CreateDatabase.svelte | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index bf41abb668..07db76353d 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -164,6 +164,7 @@ const initialise = (store, initial) => async () => { initial.actions = values(pkg.appDefinition.actions) initial.triggers = pkg.appDefinition.triggers initial.appInstances = pkg.application.instances + initial.appId = pkg.application.id if (!!initial.hierarchy && !isEmpty(initial.hierarchy)) { initial.hierarchy = constructHierarchy(initial.hierarchy) diff --git a/packages/builder/src/common/core.js b/packages/builder/src/common/core.js index 9d0bd7afdf..18da89033b 100644 --- a/packages/builder/src/common/core.js +++ b/packages/builder/src/common/core.js @@ -118,6 +118,7 @@ export const getNewInstance = (appId, name) => { version: { key: "" }, isNew: true, type: "instance", + datastoreconfig: "", id, name, } diff --git a/packages/builder/src/database/ModelDataTable/api.js b/packages/builder/src/database/ModelDataTable/api.js index 1318eab71f..b865fffd56 100644 --- a/packages/builder/src/database/ModelDataTable/api.js +++ b/packages/builder/src/database/ModelDataTable/api.js @@ -2,7 +2,7 @@ import { getNewRecord, getNewInstance } from "../../common/core" export async function createDatabase(appname, instanceName) { - const CREATE_DATABASE_URL = `/_builder/instance/_master/0/api/record` + const CREATE_DATABASE_URL = `/_builder/instance/_master/0/api/record/` const database = getNewInstance(appname, instanceName); const response = await api.post(CREATE_DATABASE_URL, database); return await response.json() diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateDatabase.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateDatabase.svelte index f335c82246..777d53dc59 100644 --- a/packages/builder/src/database/ModelDataTable/modals/CreateDatabase.svelte +++ b/packages/builder/src/database/ModelDataTable/modals/CreateDatabase.svelte @@ -9,7 +9,7 @@ let databaseName async function createDatabase() { - const response = await api.createDatabase($store.appname, databaseName) + const response = await api.createDatabase($store.appId, databaseName) store.createDatabaseForApp(response) onClosed() }