Adds display order to categories

This commit is contained in:
Aaron Louie 2020-03-26 15:29:52 -04:00
parent 4ed89eec5b
commit f77ebe3177
4 changed files with 33 additions and 1 deletions

View File

@ -894,6 +894,8 @@ components:
type: string type: string
display_name: display_name:
type: string type: string
display_order:
type: integer
File: File:
properties: properties:
id: id:

View File

@ -12,6 +12,7 @@ class WorkflowSpecCategoryModel(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String) name = db.Column(db.String)
display_name = db.Column(db.String) display_name = db.Column(db.String)
display_order = db.Column(db.Integer)
class WorkflowSpecCategoryModelSchema(SQLAlchemyAutoSchema): class WorkflowSpecCategoryModelSchema(SQLAlchemyAutoSchema):

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: 5e0709e172fa
Revises: ddd5fc9ea75b
Create Date: 2020-03-26 14:05:06.607043
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5e0709e172fa'
down_revision = 'ddd5fc9ea75b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('workflow_spec_category', sa.Column('display_order', sa.Integer(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('workflow_spec_category', 'display_order')
# ### end Alembic commands ###

View File

@ -49,7 +49,7 @@ class TestWorkflowSpec(BaseTest):
def test_update_workflow_specification(self): def test_update_workflow_specification(self):
self.load_example_data() self.load_example_data()
category = WorkflowSpecCategoryModel(id=0, name='trap', display_name="It's a trap!") category = WorkflowSpecCategoryModel(id=0, name='trap', display_name="It's a trap!", display_order=0)
session.add(category) session.add(category)
session.commit() session.commit()
@ -71,6 +71,7 @@ class TestWorkflowSpec(BaseTest):
self.assertIsNotNone(db_spec_after.workflow_spec_category_id) self.assertIsNotNone(db_spec_after.workflow_spec_category_id)
self.assertIsNotNone(db_spec_after.workflow_spec_category) self.assertIsNotNone(db_spec_after.workflow_spec_category)
self.assertEqual(db_spec_after.workflow_spec_category.display_name, category.display_name) self.assertEqual(db_spec_after.workflow_spec_category.display_name, category.display_name)
self.assertEqual(db_spec_after.workflow_spec_category.display_order, category.display_order)
def test_delete_workflow_specification(self): def test_delete_workflow_specification(self):
self.load_example_data() self.load_example_data()