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:
Rebecca Law
2018-09-13 17:06:36 +01:00
parent 39b01f145f
commit 79815b4f8a
5 changed files with 49 additions and 0 deletions

View File

@@ -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)