mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
In order to support sending letters by first class we need a way to know how the service wants us to send the letter.
To start with this will be an attribute on the service, at the time the notification is created it will look at Service.letter_class to decide what class to use for the letter. This PR adds Service.letter class as a nullable column. Updated the create_service and update_service method to default the value to second. Subsequent PRs will add the check constraint to ensure we only get first or second in the letter_class column and make that column nullable. This can't be done all at once because it will cause an error if someone inserts or updates a service during the deploy.
This commit is contained in:
@@ -167,6 +167,7 @@ def dao_create_service(service, user, service_id=None, service_permissions=None)
|
||||
service.active = True
|
||||
service.research_mode = False
|
||||
service.crown = service.organisation_type == 'central'
|
||||
service.letter_class = 'second'
|
||||
|
||||
for permission in service_permissions:
|
||||
service_permission = ServicePermission(service_id=service.id, permission=permission)
|
||||
@@ -180,6 +181,7 @@ def dao_create_service(service, user, service_id=None, service_permissions=None)
|
||||
@transactional
|
||||
@version_class(Service)
|
||||
def dao_update_service(service):
|
||||
service.letter_class = service.letter_class or 'second'
|
||||
db.session.add(service)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user