Added table selected_user for ticket 319.

We now store a user's selected_user so they see a filtered list of studies when returning to the PB Mock homepage
This commit is contained in:
mike cullerton 2021-05-11 16:33:44 -04:00
parent 5fa0ae8958
commit 688023a248
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,28 @@
"""empty message
Revision ID: 6c34576847ab
Revises: c14ddab2e6ca
Create Date: 2021-05-11 11:10:14.725089
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6c34576847ab'
down_revision = 'c14ddab2e6ca'
branch_labels = None
depends_on = None
def upgrade():
op.create_table('selected_user',
sa.Column('user_id', sa.String(), nullable=False),
sa.Column('selected_user', sa.String(), nullable=True),
sa.PrimaryKeyConstraint('user_id')
)
def downgrade():
op.drop_table('selected_user')

View File

@ -281,9 +281,19 @@ class StudyDetails(db.Model):
REVIEWTYPENAME = db.Column(db.String, nullable=True)
class StudyDetailsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = StudyDetails
load_instance = True
include_relationships = False
class SelectedUser(db.Model):
user_id = db.Column(db.String(), primary_key=True)
selected_user = db.Column(db.String(), nullable=True)
class SelectedUserSchema(ma.Schema):
class Meta:
fields = ("user_id", "selected_user")