mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
New table returned-letters
The table will contain notification ids for services that have returned letters. This will make it easy to query the data in Notification_history since we can join on the primary key.
This commit is contained in:
0
app/dao/returned_letters_dao.py
Normal file
0
app/dao/returned_letters_dao.py
Normal file
@@ -2018,8 +2018,7 @@ class Complaint(db.Model):
|
||||
__tablename__ = 'complaints'
|
||||
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
notification_id = db.Column(UUID(as_uuid=True), db.ForeignKey('notification_history.id'),
|
||||
index=True, nullable=False)
|
||||
notification_id = db.Column(UUID(as_uuid=True), index=True, nullable=False)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), unique=False, index=True, nullable=False)
|
||||
service = db.relationship(Service, backref=db.backref('complaints'))
|
||||
ses_feedback_id = db.Column(db.Text, nullable=True)
|
||||
@@ -2071,3 +2070,14 @@ class ServiceDataRetention(db.Model):
|
||||
"created_at": self.created_at.strftime(DATETIME_FORMAT),
|
||||
"updated_at": self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None,
|
||||
}
|
||||
|
||||
|
||||
class ReturnedLetter(db.Model):
|
||||
__tablename__ = 'returned_letters'
|
||||
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
reported_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), unique=False, index=True, nullable=False)
|
||||
service = db.relationship(Service, backref=db.backref('returned_letters'))
|
||||
notification_id = db.Column(UUID(as_uuid=True), unique=True, nullable=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user