Fixing an issue with deletion action.
This commit is contained in:
parent
cc5994539d
commit
05f3666257
|
@ -183,11 +183,13 @@ exports.destroy = async function(ctx) {
|
|||
const db = new CouchDB(ctx.user.instanceId)
|
||||
const record = await db.get(ctx.params.recordId)
|
||||
if (record.modelId !== ctx.params.modelId) {
|
||||
ctx.throw(400, "Supplied modelId doe not match the record's modelId")
|
||||
ctx.throw(400, "Supplied modelId doesn't match the record's modelId")
|
||||
return
|
||||
}
|
||||
ctx.body = await db.remove(ctx.params.recordId, ctx.params.revId)
|
||||
ctx.status = 200
|
||||
// for workflows
|
||||
ctx.record = record
|
||||
emitEvent(`record:delete`, ctx, record)
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ module.exports.run = async function({ inputs, instanceId }) {
|
|||
await recordController.destroy(ctx)
|
||||
return {
|
||||
response: ctx.body,
|
||||
record: ctx.record,
|
||||
success: ctx.status === 200,
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue