Add JSON schema for updating template

We did not have a JSON schema for updating a template. Since we will
remove the postage constraint from the templates table, this adds a JSON
schema for updating a template so that we can use it to check that the
postage is one of the allowed values.
This commit is contained in:
Katie Smith
2020-06-09 17:44:09 +01:00
parent 15112b2148
commit 72be10c681
3 changed files with 38 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ from app.models import SMS_TYPE, Template, SECOND_CLASS, LETTER_TYPE
from app.notifications.validators import service_has_permission, check_reply_to
from app.schema_validation import validate
from app.schemas import (template_schema, template_history_schema)
from app.template.template_schemas import post_create_template_schema
from app.template.template_schemas import post_create_template_schema, post_update_template_schema
from app.utils import get_public_notify_type_text
template_blueprint = Blueprint('template', __name__, url_prefix='/service/<uuid:service_id>/template')
@@ -110,6 +110,7 @@ def update_template(service_id, template_id):
raise InvalidRequest(errors, 403)
data = request.get_json()
validate(data, post_update_template_schema)
# if redacting, don't update anything else
if data.get('redact_personalisation') is True: