Fixing some caching issues and places where the updates were not being processed completed. And updates to the docker file.

This commit is contained in:
Dan Funk 2019-12-31 11:31:30 -05:00
parent 0685b282e8
commit 9a195bedad
5 changed files with 20 additions and 6 deletions

View File

@ -18,6 +18,10 @@ RUN pipenv install --dev
ENV FLASK_APP=./crc/__init__.py
# run migrations
CMD ["pipenv", "run", "flask", "db", "upgrade"]
CMD ["pipenv", "run", "flask", "load-example-data"]
# include rejoiner code (gets overriden by local changes)
COPY . /crc-workflow/
@ -26,3 +30,5 @@ CMD ["pipenv", "run", "python", "/crc-workflow/run.py"]
# expose ports
EXPOSE 5000

View File

@ -38,6 +38,7 @@ def update_file_from_request(file_model):
db.session.add(file_data_model)
db.session.add(file_model)
db.session.commit()
db.session.flush() # Assure the id is set on the model before returning it.
@ -74,7 +75,8 @@ def get_file(file_id):
return send_file(
io.BytesIO(file_data.data),
attachment_filename=file_data.file_model.name,
mimetype=file_data.file_model.content_type
mimetype=file_data.file_model.content_type,
cache_timeout=-1 # Don't cache these files on the browser.
)

View File

@ -14,8 +14,11 @@ def get_workflow(workflow_id):
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()
return schema.dump(workflow)
def delete(workflow_id):
db.session.query(WorkflowModel).filter_by(id=workflow_id).delete()
db.session.commit()
def get_tasks(workflow_id):
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()

View File

@ -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.6.0-dev">
<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: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 want to remain anonymous?" type="boolean">
<camunda:formField id="is_anonymous" label="Do you enjoy fried chicken with pickles?" type="boolean">
<camunda:properties>
<camunda:property id="description" value="Choose &#34;yes&#34; if you don&#39;t want us to use your name" />
<camunda:property id="help" value="# Heading 1\n\nOh hey, it&#39;s Markdown text." />
@ -33,7 +33,7 @@
<camunda:constraint name="required" config="true" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="should_send_greeting" label="Say hi to user?" type="enum" defaultValue="yes">
<camunda:formField id="should_send_greeting" label="Is Alex a lovely person?" type="enum" defaultValue="yes">
<camunda:properties>
<camunda:property id="label_expression" value="model.name ? &#39;Say hi to &#39; + model.name + &#39;?&#39; : &#39;Say hi?&#39;" />
<camunda:property id="hide_expression" value="model.is_anonymous" />

View File

@ -4,7 +4,7 @@ import unittest
from datetime import datetime
from crc import db
from crc.models import WorkflowSpecModel, FileModel, FileType, FileSchema
from crc.models import WorkflowSpecModel, FileModel, FileType, FileSchema, FileDataModel
from tests.base_test import BaseTest
@ -68,7 +68,7 @@ class TestApiFiles(BaseTest, unittest.TestCase):
file = db.session.query(FileModel).filter_by(workflow_spec_id = spec.id).first()
data = {}
data['file'] = io.BytesIO(b"abcdef"), 'random_fact.bpmn'
data['file'] = io.BytesIO(b"hijklim"), 'random_fact.bpmn'
rv = self.app.put('/v1.0/file/%i' % file.id, data=data, follow_redirects=True,
content_type='multipart/form-data')
@ -83,6 +83,9 @@ class TestApiFiles(BaseTest, unittest.TestCase):
self.assertEqual("application/octet-stream", file.content_type)
self.assertEqual(spec.id, file.workflow_spec_id)
data_model = db.session.query(FileDataModel).filter_by(file_model_id = file.id).first()
self.assertEqual(b"hijklim", data_model.data)
def test_get_file(self):
self.load_example_data()
spec = db.session.query(WorkflowSpecModel).first()