cr-connect-workflow/crc/models/email.py

31 lines
1.0 KiB
Python
Raw Normal View History

2020-06-10 04:57:56 +00:00
from flask_marshmallow.sqla import SQLAlchemyAutoSchema
from marshmallow import EXCLUDE, INCLUDE
2020-06-10 04:57:56 +00:00
from sqlalchemy import func
from crc import db, ma
2020-06-17 23:00:16 +00:00
from crc.models.study import StudyModel
2020-06-10 04:57:56 +00:00
class EmailModel(db.Model):
__tablename__ = 'email'
id = db.Column(db.Integer, primary_key=True)
subject = db.Column(db.String)
sender = db.Column(db.String)
recipients = db.Column(db.String)
cc = db.Column(db.String, nullable=True)
bcc = db.Column(db.String, nullable=True)
2020-06-10 04:57:56 +00:00
content = db.Column(db.String)
content_html = db.Column(db.String)
2020-06-17 23:00:16 +00:00
study_id = db.Column(db.Integer, db.ForeignKey(StudyModel.id), nullable=True)
timestamp = db.Column(db.DateTime(timezone=True), default=func.now())
workflow_spec_id = db.Column(db.String, nullable=True)
2020-06-17 23:00:16 +00:00
study = db.relationship(StudyModel)
class EmailModelSchema(ma.Schema):
2021-10-13 15:42:01 +00:00
class Meta:
model = EmailModel
2021-10-13 15:42:01 +00:00
fields = ["id", "subject", "sender", "recipients", "cc", "bcc", "content", "content_html",
"study_id", "timestamp", "workflow_spec_id"]