Browse Source

Fixing an issue with the fill in of test data when triggering.

pull/630/head
mike12345567 6 years ago
parent
commit
dfe3257993
  1. 3
      packages/server/src/automations/actions.js
  2. 10
      packages/server/src/automations/triggers.js

3
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 = {

10
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"
}

Loading…
Cancel
Save