mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-26 18:31:37 -05:00
Adds a relationship between Template models and service letter contact blocks. Depending on template type, we can have a reference to either a letter contact block, email reply-to address or SMS sender record. This means that in order to enforce foreign key constraints we need to define three separate foreign key columns on the template model. To hide this implementation detail and make it easier to access the sender/reply-to information we define a wrapper property that returns the value from the correct column. The relationship and the property are only defined for letter templates at the moment. The setter raises an error when trying to assign a reply_to value for non-letter templates. The exception isn't raised if the value being assigned is `None` since it can get assigned by marshmallow schemas and as it matches the value returned for other template types it doesn't need to be written anywhere.