Set free_sms_fragment_limit when creating a service

The free_sms_fragment_limit of a service is set when the service is
created. If a value for the free_sms_fragment_limit is not given, the
default value is used.
This commit is contained in:
Katie Smith
2017-10-12 12:07:52 +01:00
parent f95282a84d
commit 2001bfca36
2 changed files with 80 additions and 2 deletions

View File

@@ -138,6 +138,10 @@ def create_service():
errors = {'user_id': ['Missing data for required field.']}
raise InvalidRequest(errors, status_code=400)
# TODO: to be removed when front-end is updated
if 'free_sms_fragment_limit' not in data:
data['free_sms_fragment_limit'] = current_app.config['FREE_SMS_TIER_FRAGMENT_COUNT']
# validate json with marshmallow
service_schema.load(request.get_json())