Fix record patch function

This commit is contained in:
Andrew Kingston 2020-10-04 17:59:20 +01:00
parent 36cf5d5631
commit da035452e6
1 changed files with 3 additions and 3 deletions

View File

@ -18,8 +18,8 @@ validateJs.extend(validateJs.validators.datetime, {
exports.patch = async function(ctx) { exports.patch = async function(ctx) {
const instanceId = ctx.user.instanceId const instanceId = ctx.user.instanceId
const db = new CouchDB(instanceId) const db = new CouchDB(instanceId)
const model = await db.get(record.modelId)
let record = await db.get(ctx.params.id) let record = await db.get(ctx.params.id)
const model = await db.get(record.modelId)
const patchfields = ctx.request.body const patchfields = ctx.request.body
for (let key of Object.keys(patchfields)) { for (let key of Object.keys(patchfields)) {