mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 12:48:25 +00:00
Adds default_value to Task schema
This commit is contained in:
parent
386df9e912
commit
16db1e3504
@ -708,7 +708,7 @@ components:
|
||||
name: "Expedited"
|
||||
- id: "full_board"
|
||||
name: "Full Board"
|
||||
"defaultValue": "Full Board"
|
||||
"default_value": "Full Board"
|
||||
"validation":
|
||||
- name: "required"
|
||||
config: "true"
|
||||
@ -752,7 +752,7 @@ components:
|
||||
name: "Expedited"
|
||||
- id: "full_board"
|
||||
name: "Full Board"
|
||||
"defaultValue": "Full Board"
|
||||
"default_value": "Full Board"
|
||||
"validation":
|
||||
- name: "required"
|
||||
config: "true"
|
||||
@ -782,8 +782,9 @@ components:
|
||||
items:
|
||||
$ref: "#/components/schemas/EnumFieldOption"
|
||||
readOnly: true
|
||||
defaultValue:
|
||||
default_value:
|
||||
type: string
|
||||
readOnly: true
|
||||
validation:
|
||||
type: array
|
||||
items:
|
||||
|
@ -29,6 +29,7 @@ class FileType(enum.Enum):
|
||||
xml = 'xml'
|
||||
zip = 'zip'
|
||||
|
||||
|
||||
class FileDataModel(db.Model):
|
||||
__tablename__ = 'file_data'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
@ -58,5 +59,3 @@ class FileModelSchema(ModelSchema):
|
||||
model = FileModel
|
||||
include_fk = True # Includes foreign keys
|
||||
type = EnumField(FileType)
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import enum
|
||||
|
||||
import marshmallow
|
||||
from marshmallow import post_dump, pre_dump, EXCLUDE, INCLUDE
|
||||
from marshmallow import INCLUDE
|
||||
from marshmallow_enum import EnumField
|
||||
from marshmallow_sqlalchemy import ModelSchema
|
||||
|
||||
@ -16,6 +16,7 @@ class WorkflowSpecModel(db.Model):
|
||||
description = db.Column(db.Text)
|
||||
primary_process_id = db.Column(db.String)
|
||||
|
||||
|
||||
class WorkflowSpecModelSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = WorkflowSpecModel
|
||||
@ -85,9 +86,10 @@ class PropertiesSchema(ma.Schema):
|
||||
class FormFieldSchema(ma.Schema):
|
||||
class Meta:
|
||||
fields = [
|
||||
"id", "type", "label", "defaultValue", "options", "validation", "properties", "value"
|
||||
"id", "type", "label", "default_value", "options", "validation", "properties", "value"
|
||||
]
|
||||
|
||||
default_value = marshmallow.fields.String(required=False, allow_none=True)
|
||||
options = marshmallow.fields.List(marshmallow.fields.Nested(OptionSchema))
|
||||
validation = marshmallow.fields.List(marshmallow.fields.Nested(ValidationSchema))
|
||||
properties = marshmallow.fields.List(marshmallow.fields.Nested(PropertiesSchema))
|
||||
@ -120,11 +122,13 @@ class WorkflowApi(object):
|
||||
self.next_task = next_task
|
||||
self.workflow_spec_id = workflow_spec_id
|
||||
|
||||
|
||||
class WorkflowApiSchema(ma.Schema):
|
||||
class Meta:
|
||||
model = WorkflowApi
|
||||
fields = ["id", "status", "user_tasks", "last_task", "next_task", "workflow_spec_id"]
|
||||
unknown = INCLUDE
|
||||
|
||||
status = EnumField(WorkflowStatus)
|
||||
user_tasks = marshmallow.fields.List(marshmallow.fields.Nested(TaskSchema, dump_only=True))
|
||||
last_task = marshmallow.fields.Nested(TaskSchema, dump_only=True)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
|
||||
<bpmn:process id="Process_1ds61df" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>SequenceFlow_0ik56h0</bpmn:outgoing>
|
||||
@ -14,7 +14,7 @@
|
||||
<camunda:value id="cat" name="Cat Fact" />
|
||||
<camunda:value id="buzzword" name="Business Buzzword" />
|
||||
</camunda:formField>
|
||||
<camunda:formField id="is_anonymous" label="Do you enjoy fried chicken with pickles?" type="boolean">
|
||||
<camunda:formField id="is_anonymous" label="Do you want to remain anonymous?" type="boolean" defaultValue="yes">
|
||||
<camunda:properties>
|
||||
<camunda:property id="description" value="Choose "yes" if you don't want us to use your name" />
|
||||
<camunda:property id="help" value="# Heading 1\n\nOh hey, it's Markdown text." />
|
||||
@ -23,7 +23,7 @@
|
||||
<camunda:constraint name="required" config="true" />
|
||||
</camunda:validation>
|
||||
</camunda:formField>
|
||||
<camunda:formField id="name" label="Your full name" type="string">
|
||||
<camunda:formField id="name" label="Your full name" type="string" defaultValue="Poopsy McButtface">
|
||||
<camunda:properties>
|
||||
<camunda:property id="description" value="Please enter your first and last name." />
|
||||
<camunda:property id="help" value="# Heading 1\n\nLook, it's some Markdown!" />
|
||||
@ -50,6 +50,7 @@
|
||||
<camunda:value id="Value_2mknvfh" name="21" />
|
||||
<camunda:value id="Value_1atqgco" name="7" />
|
||||
</camunda:formField>
|
||||
<camunda:formField id="start_date" label="When should the party start?" type="date" />
|
||||
</camunda:formData>
|
||||
<camunda:properties>
|
||||
<camunda:property name="type" value="string" />
|
||||
|
@ -15,7 +15,7 @@ class TestTasksApi(BaseTest):
|
||||
spec = session.query(WorkflowSpecModel).filter_by(id=workflow_name).first()
|
||||
self.app.post('/v1.0/study/%i/workflows' % study.id, content_type="application/json",
|
||||
data=json.dumps(WorkflowSpecModelSchema().dump(spec)))
|
||||
workflow = session.query(WorkflowModel).filter_by(study_id = study.id, workflow_spec_id=workflow_name).first()
|
||||
workflow = session.query(WorkflowModel).filter_by(study_id=study.id, workflow_spec_id=workflow_name).first()
|
||||
return workflow
|
||||
|
||||
def get_workflow_api(self, workflow):
|
||||
@ -96,7 +96,7 @@ class TestTasksApi(BaseTest):
|
||||
workflow_api = self.complete_form(workflow, tasks[0], {"has_bananas": True})
|
||||
|
||||
self.assertIsNotNone(workflow_api.last_task)
|
||||
self.assertEquals({"has_bananas": True}, workflow_api.last_task['data'])
|
||||
self.assertEqual({"has_bananas": True}, workflow_api.last_task['data'])
|
||||
|
||||
def test_get_workflow_contains_reference_to_last_task_and_next_task(self):
|
||||
self.load_example_data()
|
||||
@ -130,4 +130,4 @@ class TestTasksApi(BaseTest):
|
||||
self.assert_success(rv)
|
||||
json_data = json.loads(rv.get_data(as_text=True))
|
||||
files = FileModelSchema(many=True).load(json_data, session=session)
|
||||
self.assertTrue(len(files) == 1)
|
||||
self.assertTrue(len(files) == 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user