Updating definitions to remove the use of the fat model object in workflows and make sure the record structure is common where-ever it is used (as an input or as a trigger output).

This commit is contained in:
mike12345567 2020-09-16 11:20:00 +01:00
parent 43afb9af1b
commit a08ef045bc
1 changed files with 31 additions and 18 deletions

View File

@ -4,7 +4,7 @@ let conditions = require("../../../workflows/logic").LogicConditions
const ACTION = { const ACTION = {
SAVE_RECORD: { SAVE_RECORD: {
name: "Save Record", name: "Save Record",
tagline: "Save a {{inputs.record.model.name}} record", tagline: "Save a {{inputs.enriched.model.name}} record",
icon: "ri-save-3-fill", icon: "ri-save-3-fill",
description: "Save a record to your database", description: "Save a record to your database",
type: "ACTION", type: "ACTION",
@ -14,17 +14,20 @@ const ACTION = {
properties: { properties: {
record: { record: {
type: "object", type: "object",
properties: {
modelId: {
type: "string",
customType: "model",
title: "Table",
},
},
customType: "record", customType: "record",
title: "The record to be written", title: "The record to be written",
default: {}, default: {},
}, required: ["modelId"],
model: {
type: "object",
customType: "model",
title: "Table",
}, },
}, },
required: ["record", "model"], required: ["record"],
}, },
outputs: { outputs: {
properties: { properties: {
@ -53,12 +56,17 @@ const ACTION = {
description: "Delete a record from your database", description: "Delete a record from your database",
icon: "ri-delete-bin-line", icon: "ri-delete-bin-line",
name: "Delete Record", name: "Delete Record",
tagline: "Delete a {{inputs.record.model.name}} record", tagline: "Delete a {{inputs.enriched.model.name}} record",
type: "ACTION", type: "ACTION",
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
modelId: {
type: "string",
customType: "model",
title: "Table",
},
id: { id: {
type: "string", type: "string",
title: "Record ID", title: "Record ID",
@ -68,10 +76,15 @@ const ACTION = {
title: "Record Revision", title: "Record Revision",
}, },
}, },
required: ["id", "revision"], required: ["modelId", "id", "revision"],
}, },
outputs: { outputs: {
properties: { properties: {
record: {
type: "object",
customType: "record",
description: "The deleted record",
},
response: { response: {
type: "object", type: "object",
description: "The response from the table", description: "The response from the table",
@ -81,7 +94,7 @@ const ACTION = {
description: "Whether the action was successful", description: "Whether the action was successful",
}, },
}, },
required: ["success"], required: ["record", "success"],
}, },
}, },
}, },
@ -246,19 +259,19 @@ const TRIGGER = {
name: "Record Saved", name: "Record Saved",
event: "record:save", event: "record:save",
icon: "ri-save-line", icon: "ri-save-line",
tagline: "Record is added to {{inputs.model.name}}", tagline: "Record is added to {{inputs.enriched.model.name}}",
description: "Fired when a record is saved to your database", description: "Fired when a record is saved to your database",
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
model: { modelId: {
type: "object", type: "string",
customType: "model", customType: "model",
title: "Table", title: "Table",
}, },
}, },
required: ["model"], required: ["modelId"],
}, },
outputs: { outputs: {
properties: { properties: {
@ -277,19 +290,19 @@ const TRIGGER = {
name: "Record Deleted", name: "Record Deleted",
event: "record:delete", event: "record:delete",
icon: "ri-delete-bin-line", icon: "ri-delete-bin-line",
tagline: "Record is deleted from {{inputs.model.name}}", tagline: "Record is deleted from {{inputs.enriched.model.name}}",
description: "Fired when a record is deleted from your database", description: "Fired when a record is deleted from your database",
inputs: {}, inputs: {},
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
model: { modelId: {
type: "object", type: "string",
customType: "model", customType: "model",
title: "Table", title: "Table",
}, },
}, },
required: ["model"], required: ["modelId"],
}, },
outputs: { outputs: {
properties: { properties: {