diff --git a/packages/builder/src/components/database/ModelDataTable/api.js b/packages/builder/src/components/database/ModelDataTable/api.js
index c573814e88..e9592074bf 100644
--- a/packages/builder/src/components/database/ModelDataTable/api.js
+++ b/packages/builder/src/components/database/ModelDataTable/api.js
@@ -1,6 +1,6 @@
import api from "builderStore/api"
-export async function createUser(user, appId, instanceId) {
+export async function createUser(user, instanceId) {
const CREATE_USER_URL = `/api/${instanceId}/users`
const response = await api.post(CREATE_USER_URL, user)
return await response.json()
@@ -15,20 +15,20 @@ export async function createDatabase(appname, instanceName) {
}
export async function deleteRecord(record, instanceId) {
- const DELETE_RECORDS_URL = `/api/${instanceId}/records/${record._id}/${record._rev}`
+ const DELETE_RECORDS_URL = `/api/${instanceId}/${record.modelId}/records/${record._id}/${record._rev}`
const response = await api.delete(DELETE_RECORDS_URL)
return response
}
export async function saveRecord(record, instanceId) {
- const SAVE_RECORDS_URL = `/api/${instanceId}/records`
+ const SAVE_RECORDS_URL = `/api/${instanceId}/${record.modelId}/records`
const response = await api.post(SAVE_RECORDS_URL, record)
return await response.json()
}
export async function fetchDataForView(viewName, instanceId) {
- const FETCH_RECORDS_URL = `/api/${instanceId}/${viewName}/records`
+ const FETCH_RECORDS_URL = `/api/${instanceId}/views/${viewName}`
const response = await api.get(FETCH_RECORDS_URL)
return await response.json()
diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte
index 842703af1c..77e0850b87 100644
--- a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte
+++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte
@@ -7,14 +7,15 @@
let username
let password
+ let accessLevelId
- $: valid = username && password
+ $: valid = username && password && accessLevelId
$: instanceId = $backendUiStore.selectedDatabase._id
$: appId = $store.appId
async function createUser() {
- const user = { name: username, username, password }
- const response = await api.createUser(user, appId, instanceId)
+ const user = { name: username, username, password, accessLevelId }
+ const response = await api.createUser(user, instanceId)
backendUiStore.actions.users.create(response)
onClosed()
}
@@ -30,6 +31,14 @@
+
+
+
+