From da035452e6016153a8a9be43326b1a8030dd3d87 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sun, 4 Oct 2020 17:59:20 +0100 Subject: [PATCH] Fix record patch function --- packages/server/src/api/controllers/record.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/record.js b/packages/server/src/api/controllers/record.js index 3559a2568b..45d983eb2b 100644 --- a/packages/server/src/api/controllers/record.js +++ b/packages/server/src/api/controllers/record.js @@ -18,8 +18,8 @@ validateJs.extend(validateJs.validators.datetime, { exports.patch = async function(ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) - const model = await db.get(record.modelId) let record = await db.get(ctx.params.id) + const model = await db.get(record.modelId) const patchfields = ctx.request.body for (let key of Object.keys(patchfields)) { @@ -152,14 +152,14 @@ exports.fetchView = async function(ctx) { exports.fetchModelRecords = async function(ctx) { const instanceId = ctx.user.instanceId - const db = new CouchDB(instanceId) + const db = new CouchDB(instanceId) const response = await db.allDocs( getRecordParams(ctx.params.modelId, null, { include_docs: true, }) ) ctx.body = response.rows.map(row => row.doc) - ctx.body = await linkRecords.attachLinkInfo( + ctx.body = await linkRecords.attachLinkInfo( instanceId, response.rows.map(row => row.doc) )