Use the template version at the time the notification is created or at the time the job is created.

Update notifications/sms|email endpoint to send the template version to the queue.
Update the process_job celery talk to send the template version to the queue.
When the send_sms|send_email task runs it will get the template by id and version.

Created a data migration script to add the template_vesion column for jobs and notifications.
The existing jobs and notifications are given the template_version of the current template.
There is a chance this is the wrong template version, but deemed okay since the application is not live.

Create unit test for the dao_get_template_versions method.
Rename /template/<id>/version to /template/<id>/versions which returns all versions for that template id and service id.
This commit is contained in:
Rebecca Law
2016-05-13 16:25:05 +01:00
parent c8c0f95dd2
commit 917110870d
12 changed files with 220 additions and 114 deletions

View File

@@ -107,18 +107,18 @@ def get_template_version(service_id, template_id, version):
)
)
if errors:
return json_resp(result='error', message=errors), 400
return jsonify(result='error', message=errors), 400
return jsonify(data=data)
@template.route('/<uuid:template_id>/version')
@template.route('/<uuid:template_id>/versions')
def get_template_versions(service_id, template_id):
data, errors = template_history_schema.dump(
dao_get_template_versions(service_id, template_id),
dao_get_template_versions(service_id=service_id, template_id=template_id),
many=True
)
if errors:
return json_resp(result='error', message=errors), 400
return jsonify(result='error', message=errors), 400
return jsonify(data=data)