Merge branch 'server-workflows' of github.com:Budibase/budibase into server-workflows

This commit is contained in:
Andrew Kingston 2020-09-14 11:53:19 +01:00
commit 590e7d810d
1 changed files with 25 additions and 0 deletions

View File

@ -77,6 +77,31 @@ let BUILTIN_ACTIONS = {
}
}
},
DELETE_RECORD: async function({ args, context }) {
const { model, ...record } = args.record
// TODO: better logging of when actions are missed due to missing parameters
if (record.recordId == null || record.revId == null) {
return
}
let ctx = {
params: {
modelId: model._id,
recordId: record.recordId,
revId: record.revId,
},
user: { instanceId: context.instanceId },
}
try {
await recordController.destroy(ctx)
} catch (err) {
console.error(err)
return {
record: null,
error: err.message,
}
}
},
}
module.exports.getAction = async function(actionName) {