mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-11 05:01:12 -05:00
Refactored post template
This commit is contained in:
@@ -29,11 +29,8 @@ def post_template_preview(template_id):
|
||||
|
||||
check_placeholders(template_object)
|
||||
|
||||
subject = template_object.subject if template.template_type != SMS_TYPE else None
|
||||
|
||||
resp = create_post_template_preview_response(template=template,
|
||||
subject=subject,
|
||||
body=str(template_object))
|
||||
template_object=template_object)
|
||||
|
||||
return jsonify(resp), 200
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from app.models import TEMPLATE_TYPES
|
||||
from app.models import SMS_TYPE, TEMPLATE_TYPES
|
||||
from app.schema_validation.definitions import uuid, personalisation
|
||||
|
||||
|
||||
@@ -68,11 +68,13 @@ post_template_preview_response = {
|
||||
}
|
||||
|
||||
|
||||
def create_post_template_preview_response(template, subject, body):
|
||||
def create_post_template_preview_response(template, template_object):
|
||||
subject = template_object.subject if template.template_type != SMS_TYPE else None
|
||||
|
||||
return {
|
||||
"id": template.id,
|
||||
"type": template.template_type,
|
||||
"version": template.version,
|
||||
"body": body,
|
||||
"body": str(template_object),
|
||||
"subject": subject
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user