Fixing an issue with the fill in of test data when triggering.
This commit is contained in:
parent
aaa8313c50
commit
ad6002293e
|
@ -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 = {
|
||||
|
|
|
@ -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…
Reference in New Issue