Skip to content

Instantly share code, notes, and snippets.

@paolobueno
Forked from wtrocki/workflow.js
Created September 4, 2017 16:28
Show Gist options
  • Select an option

  • Save paolobueno/acbb0823183124c6a0f8906ad9cad015 to your computer and use it in GitHub Desktop.

Select an option

Save paolobueno/acbb0823183124c6a0f8906ad9cad015 to your computer and use it in GitHub Desktop.
Workflow mobile data structure
var workorder = {
"_id": "59aafac97037bfbab2a8f9a1",
"id": "SJ8b3Mr8g",
"assignee": "rkX1fdSH",
"title": "Accident No. 3019",
"status": "New",
"stepHistory": [
{
id: 'someid',
user: 'trever'
}
], // This is created when we going thru workflow.
// Array of results as they are filled,
// previous() could just delete the last one, user experience tradeoff
// rendered sequentially on results screen
results: [
{
stepId: 'someid',
timestamp: 23165498654,
user: 'trever', // future support for multi-user workorders
data: {
tires: true,
lights: true,
fuel: 75
}
}
],
"workflow": {
"id": "SyVXyMuSr",
"version": 1, // should be easy to implement server-side
// stepFlow : _.map(workflow.steps,'id')
"stepFlow": ['someid', 'someid2', 'someid'],
"title": "Vehicle Accident Workflow",
"steps": [
{
"id": "someid",
"code": "accident-report-form",
"name": "Accident Report",
},
{
"id": "someid2",
"code": "accident-report-form",
"name": "Accident Report",
},
{
"code": "vehicle-inspection",
"name": "Vehicle Inspection",
}
]
}
};
console.dir(workorder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment