mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-06 06:30:51 -04:00
Merge branch 'master' into return-service_sms_sender_value
This commit is contained in:
@@ -208,8 +208,7 @@ class Service(db.Model, Versioned):
|
||||
created_by = db.relationship('User')
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||
_reply_to_email_address = db.Column("reply_to_email_address", db.Text, index=False, unique=False, nullable=True)
|
||||
letter_contact_block = db.Column(db.Text, index=False, unique=False, nullable=True)
|
||||
# This column is now deprecated
|
||||
_letter_contact_block = db.Column('letter_contact_block', db.Text, index=False, unique=False, nullable=True)
|
||||
sms_sender = db.Column(db.String(11), nullable=False, default=lambda: current_app.config['FROM_NUMBER'])
|
||||
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
|
||||
organisation = db.relationship('Organisation')
|
||||
@@ -274,8 +273,7 @@ class Service(db.Model, Versioned):
|
||||
if len(default_letter_contact) > 1:
|
||||
raise Exception("There should only ever be one default")
|
||||
else:
|
||||
return default_letter_contact[0].contact_block if default_letter_contact else \
|
||||
self.letter_contact_block # need to update this to None after dropping the letter_contact_block column
|
||||
return default_letter_contact[0].contact_block if default_letter_contact else None
|
||||
|
||||
|
||||
class InboundNumber(db.Model):
|
||||
@@ -549,7 +547,7 @@ class Template(db.Model):
|
||||
return LetterDVLATemplate(
|
||||
{'content': self.content, 'subject': self.subject},
|
||||
notification_reference=1,
|
||||
contact_block=self.service.letter_contact_block,
|
||||
contact_block=self.service.get_default_letter_contact(),
|
||||
)
|
||||
|
||||
def serialize(self):
|
||||
@@ -1450,3 +1448,24 @@ class ServiceLetterContact(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 NotificationEmailReplyTo(db.Model):
|
||||
__tablename__ = "notification_to_email_reply_to"
|
||||
|
||||
notification_id = db.Column(
|
||||
UUID(as_uuid=True),
|
||||
db.ForeignKey('notifications.id'),
|
||||
unique=True,
|
||||
index=True,
|
||||
nullable=False,
|
||||
primary_key=True
|
||||
)
|
||||
service_email_reply_to_id = db.Column(
|
||||
UUID(as_uuid=True),
|
||||
db.ForeignKey('service_email_reply_to.id'),
|
||||
unique=False,
|
||||
index=True,
|
||||
nullable=False,
|
||||
primary_key=True
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user