This commit is contained in:
Martin McKeaveney 2020-06-25 22:43:10 +01:00
parent 63fc10e1e0
commit fb382329b8
2 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
import { writable } from "svelte/store"
import { cloneDeep } from "lodash/fp"
import api from "../api"
import { update } from "lodash"
export const getBackendUiStore = () => {
const INITIAL_BACKEND_UI_STATE = {
@ -82,7 +81,7 @@ export const getBackendUiStore = () => {
}
const SAVE_MODEL_URL = `/api/models`
console.log(updatedModel);
console.log(updatedModel)
const response = await api.post(SAVE_MODEL_URL, updatedModel)
const savedModel = await response.json()
await store.actions.models.fetch()

View File

@ -28,8 +28,8 @@ exports.save = async function(ctx) {
const { _rename } = modelToSave
if (_rename) {
const records = await db.query(`database/all_${modelToSave._id}`, {
include_docs: true
});
include_docs: true,
})
const docs = records.rows.map(({ doc }) => {
doc[_rename.updated] = doc[_rename.old]
delete doc[_rename.old]
@ -55,7 +55,7 @@ exports.save = async function(ctx) {
modelId: modelToSave._id,
constraints: {
type: "array",
}
},
}
await db.put(linkedModel)
}