Update model to remove the string length restriction.

Moved logic to the dao from the endpoint.
This commit is contained in:
Rebecca Law
2017-06-19 12:25:05 +01:00
parent effb99dca8
commit 6202da7dea
6 changed files with 63 additions and 49 deletions

View File

@@ -17,7 +17,14 @@ def save_service_inbound_api(service_inbound_api):
@transactional
@version_class(ServiceInboundApi)
def reset_service_inbound_api(service_inbound_api):
def reset_service_inbound_api(service_inbound_api, updated_by_id, url=None, bearer_token=None):
if url:
service_inbound_api.url = url
if bearer_token:
service_inbound_api.bearer_token = generate_secret(bearer_token)
service_inbound_api.updated_by_id = updated_by_id
service_inbound_api.updated_at = datetime.utcnow()
db.session.add(service_inbound_api)