Add `pre_review` table to store info for new endpoint
Add schemas to return pre_review info json
This commit is contained in:
parent
a202148880
commit
29b8eb89ff
|
@ -0,0 +1,40 @@
|
|||
"""add pre_review table
|
||||
|
||||
Revision ID: 0659a655b5be
|
||||
Revises: fcc193c49110
|
||||
Create Date: 2022-06-16 10:03:33.853014
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0659a655b5be'
|
||||
down_revision = 'fcc193c49110'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'pre_review',
|
||||
sa.Column('PROT_EVENT_ID', sa.Integer()),
|
||||
sa.Column('SS_STUDY_ID', sa.Integer(), nullable=False),
|
||||
sa.Column('DATEENTERED', sa.DateTime(timezone=True)),
|
||||
sa.Column('REVIEW_TYPE', sa.Integer()),
|
||||
sa.Column('COMMENTS', sa.String(), nullable=False, default=''),
|
||||
sa.Column('IRBREVIEWERADMIN', sa.String()),
|
||||
sa.Column('FNAME', sa.String()),
|
||||
sa.Column('LNAME', sa.String()),
|
||||
sa.Column('LOGIN', sa.String(), nullable=False, default=''),
|
||||
sa.Column('EVENT_TYPE', sa.Integer()),
|
||||
sa.Column('STATUS', sa.String()),
|
||||
sa.Column('DETAIL', sa.String()),
|
||||
sa.ForeignKeyConstraint(['SS_STUDY_ID'], ['study.STUDYID'], ),
|
||||
sa.PrimaryKeyConstraint('PROT_EVENT_ID')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('pre_review')
|
35
pb/models.py
35
pb/models.py
|
@ -458,3 +458,38 @@ class SelectedUserSchema(ma.Schema):
|
|||
class Meta:
|
||||
fields = ("user_id", "selected_user")
|
||||
|
||||
|
||||
class PreReview(db.Model):
|
||||
__tablename__ = 'pre_review'
|
||||
|
||||
PROT_EVENT_ID = db.Column(db.Integer, primary_key=True)
|
||||
SS_STUDY_ID = db.Column(db.Integer, db.ForeignKey('study.STUDYID'))
|
||||
DATEENTERED = db.Column(db.DateTime(timezone=True), default=func.now())
|
||||
REVIEW_TYPE = db.Column(db.Integer)
|
||||
COMMENTS = db.Column(db.String)
|
||||
IRBREVIEWERADMIN = db.Column(db.String)
|
||||
FNAME = db.Column(db.String)
|
||||
LNAME = db.Column(db.String)
|
||||
LOGIN = db.Column(db.String)
|
||||
EVENT_TYPE = db.Column(db.Integer)
|
||||
STATUS = db.Column(db.String)
|
||||
DETAIL = db.Column(db.String)
|
||||
|
||||
|
||||
class PreReviewSchema(ma.Schema):
|
||||
class Meta:
|
||||
model = PreReview
|
||||
fields = ["SS_STUDY_ID", "PROT_EVENT_ID", "DATEENTERED", "REVIEW_TYPE", "UVA_STUDY_TRACKING",
|
||||
"COMMENTS", "IRBREVIEWERADMIN", "FNAME", "LNAME", "LOGIN", "EVENT_TYPE", "STATUS", "DETAIL"]
|
||||
|
||||
UVA_STUDY_TRACKING = fields.Method('get_uva_study_tracking', dump_only=True)
|
||||
|
||||
@staticmethod
|
||||
def get_uva_study_tracking(obj):
|
||||
return obj.SS_STUDY_ID
|
||||
|
||||
|
||||
class PreReviewErrorSchema(ma.Schema):
|
||||
class Meta:
|
||||
model = PreReview
|
||||
fields = ["STATUS", "DETAIL"]
|
||||
|
|
Loading…
Reference in New Issue