mirror of
https://github.com/GSA/notifications-api.git
synced 2026-06-17 03:38:14 -04:00
Add 'archived' column to the 3 reply_to models
Added a new boolean column, `archived`, with a default of False to the three models which are used to specify the 'reply to' address for notifications: * ServiceEmailReplyTo * ServiceSmsSender * ServiceLetterContact
This commit is contained in:
@@ -472,6 +472,7 @@ class ServiceSmsSender(db.Model):
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, nullable=False, unique=False)
|
||||
service = db.relationship(Service, backref=db.backref("service_sms_senders", uselist=True))
|
||||
is_default = db.Column(db.Boolean, nullable=False, default=True)
|
||||
archived = db.Column(db.Boolean, nullable=False, default=False)
|
||||
inbound_number_id = db.Column(UUID(as_uuid=True), db.ForeignKey('inbound_numbers.id'),
|
||||
unique=True, index=True, nullable=True)
|
||||
inbound_number = db.relationship(InboundNumber, backref=db.backref("inbound_number", uselist=False))
|
||||
@@ -487,6 +488,7 @@ class ServiceSmsSender(db.Model):
|
||||
"sms_sender": self.sms_sender,
|
||||
"service_id": str(self.service_id),
|
||||
"is_default": self.is_default,
|
||||
"archived": self.archived,
|
||||
"inbound_number_id": str(self.inbound_number_id) if self.inbound_number_id else None,
|
||||
"created_at": self.created_at.strftime(DATETIME_FORMAT),
|
||||
"updated_at": self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None,
|
||||
@@ -1670,6 +1672,7 @@ class ServiceEmailReplyTo(db.Model):
|
||||
|
||||
email_address = db.Column(db.Text, nullable=False, index=False, unique=False)
|
||||
is_default = db.Column(db.Boolean, nullable=False, default=True)
|
||||
archived = db.Column(db.Boolean, nullable=False, default=False)
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
||||
|
||||
@@ -1679,6 +1682,7 @@ class ServiceEmailReplyTo(db.Model):
|
||||
'service_id': str(self.service_id),
|
||||
'email_address': self.email_address,
|
||||
'is_default': self.is_default,
|
||||
'archived': self.archived,
|
||||
'created_at': self.created_at.strftime(DATETIME_FORMAT),
|
||||
'updated_at': self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None
|
||||
}
|
||||
@@ -1694,6 +1698,7 @@ class ServiceLetterContact(db.Model):
|
||||
|
||||
contact_block = db.Column(db.Text, nullable=False, index=False, unique=False)
|
||||
is_default = db.Column(db.Boolean, nullable=False, default=True)
|
||||
archived = db.Column(db.Boolean, nullable=False, default=False)
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow)
|
||||
|
||||
@@ -1703,6 +1708,7 @@ class ServiceLetterContact(db.Model):
|
||||
'service_id': str(self.service_id),
|
||||
'contact_block': self.contact_block,
|
||||
'is_default': self.is_default,
|
||||
'archived': self.archived,
|
||||
'created_at': self.created_at.strftime(DATETIME_FORMAT),
|
||||
'updated_at': self.updated_at.strftime(DATETIME_FORMAT) if self.updated_at else None
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ def test_add_reply_to_email_address_for_service_creates_first_email_for_service(
|
||||
assert len(results) == 1
|
||||
assert results[0].email_address == 'new@address.com'
|
||||
assert results[0].is_default
|
||||
assert not results[0].archived
|
||||
|
||||
|
||||
def test_add_reply_to_email_address_for_service_creates_another_email_for_service(notify_db_session):
|
||||
|
||||
@@ -39,9 +39,11 @@ def test_add_letter_contact_for_service_creates_additional_letter_contact_for_se
|
||||
|
||||
assert results[0].contact_block == 'Edinburgh, ED1 1AA'
|
||||
assert results[0].is_default
|
||||
assert not results[0].archived
|
||||
|
||||
assert results[1].contact_block == 'Swansea, SN1 3CC'
|
||||
assert not results[1].is_default
|
||||
assert not results[1].archived
|
||||
|
||||
|
||||
def test_add_another_letter_contact_as_default_overrides_existing(notify_db_session):
|
||||
|
||||
@@ -58,6 +58,7 @@ def test_dao_add_sms_sender_for_service(notify_db_session):
|
||||
assert len(service_sms_senders) == 2
|
||||
assert service_sms_senders[0].sms_sender == 'testing'
|
||||
assert service_sms_senders[0].is_default
|
||||
assert not service_sms_senders[0].archived
|
||||
assert service_sms_senders[1] == new_sms_sender
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user