From dfe3257993ed30bb174a76840cc6346688d8aeee Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 22 Sep 2020 15:25:26 +0100 Subject: [PATCH] Fixing an issue with the fill in of test data when triggering. --- packages/server/src/automations/actions.js | 3 ++- packages/server/src/automations/triggers.js | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/server/src/automations/actions.js b/packages/server/src/automations/actions.js index ed3ad7b591..ac0ae63c36 100644 --- a/packages/server/src/automations/actions.js +++ b/packages/server/src/automations/actions.js @@ -10,7 +10,8 @@ const os = require("os") const fs = require("fs") const Sentry = require("@sentry/node") -const DEFAULT_BUCKET = "https://prod-budi-automations.s3-eu-west-1.amazonaws.com" +const DEFAULT_BUCKET = + "https://prod-budi-automations.s3-eu-west-1.amazonaws.com" const DEFAULT_DIRECTORY = ".budibase-automations" const AUTOMATION_MANIFEST = "manifest.json" const BUILTIN_ACTIONS = { diff --git a/packages/server/src/automations/triggers.js b/packages/server/src/automations/triggers.js index e4e578c04d..e57ae66a82 100644 --- a/packages/server/src/automations/triggers.js +++ b/packages/server/src/automations/triggers.js @@ -124,6 +124,7 @@ async function fillRecordOutput(automation, params) { const db = new CouchDB(params.instanceId) try { let model = await db.get(modelId) + let record = {} for (let schemaKey of Object.keys(model.schema)) { if (params[schemaKey] != null) { continue @@ -131,19 +132,20 @@ async function fillRecordOutput(automation, params) { let propSchema = model.schema[schemaKey] switch (propSchema.constraints.type) { case "string": - params[schemaKey] = FAKE_STRING + record[schemaKey] = FAKE_STRING break case "boolean": - params[schemaKey] = FAKE_BOOL + record[schemaKey] = FAKE_BOOL break case "number": - params[schemaKey] = FAKE_NUMBER + record[schemaKey] = FAKE_NUMBER break case "datetime": - params[schemaKey] = FAKE_DATETIME + record[schemaKey] = FAKE_DATETIME break } } + params.record = record } catch (err) { throw "Failed to find model for trigger" }