Merge branch 'master' into celery-spike

Conflicts:
	app/notifications/rest.py
This commit is contained in:
Martyn Inglis
2016-02-15 11:12:07 +00:00
6 changed files with 146 additions and 86 deletions

View File

@@ -39,9 +39,8 @@ def create_sms_notification():
return jsonify(result="error", message=errors), 400
send_sms.delay()
add_notification_to_queue(api_user['client'], notification['template'], 'sms', notification)
# TODO data to be returned
return jsonify({}), 204
notification_id = add_notification_to_queue(api_user['client'], notification['template'], 'sms', notification)
return jsonify({'notification_id': notification_id}), 201
@notifications.route('/email', methods=['POST'])
@@ -50,9 +49,8 @@ def create_email_notification():
notification, errors = email_notification_schema.load(resp_json)
if errors:
return jsonify(result="error", message=errors), 400
add_notification_to_queue(api_user['client'], "admin", 'email', notification)
# TODO data to be returned
return jsonify({}), 204
notification_id = add_notification_to_queue(api_user['client'], "admin", 'email', notification)
return jsonify({'notification_id': notification_id}), 201
@notifications.route('/sms/service/<service_id>', methods=['POST'])
@@ -76,6 +74,5 @@ def create_sms_for_service(service_id):
message = "Invalid template: id {} for service id: {}".format(template.id, service_id)
return jsonify(result="error", message=message), 400
add_notification_to_queue(service_id, template_id, 'sms', notification)
# TODO data to be returned
return jsonify({}), 204
notification_id = add_notification_to_queue(service_id, template_id, 'sms', notification)
return jsonify({'notification_id': notification_id}), 201