Add service versioning to broadcast account type change

We are using the `set_broadcast_service_type` route to make changes to
service objects. However, we had forgotten to add the `version_class`
decorator to it which will mean the changing of a service going from
training to live mode will also be recorded in the services_history
table for free. Whilst not essential, this easy change makes things more
consistent for how we update other services.
This commit is contained in:
David McDonald
2021-03-04 17:23:09 +00:00
parent dabdc2c4ac
commit 8cf32d6f22
2 changed files with 30 additions and 2 deletions

View File

@@ -3,11 +3,19 @@ from datetime import datetime
from flask import current_app
from app import db
from app.models import ServiceBroadcastSettings, ServicePermission, Organisation, BROADCAST_TYPE, EMAIL_AUTH_TYPE
from app.dao.dao_utils import transactional
from app.dao.dao_utils import transactional, version_class
from app.models import (
Service,
ServiceBroadcastSettings,
ServicePermission,
Organisation,
BROADCAST_TYPE,
EMAIL_AUTH_TYPE
)
@transactional
@version_class(Service)
def set_broadcast_service_type(service, service_mode, broadcast_channel, provider_restriction):
insert_or_update_service_broadcast_settings(
service, channel=broadcast_channel, provider_restriction=provider_restriction