mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Add endpoint for getting / creating a hidden template
We want a way of getting the hidden precompiled template from admin, so this adds an endpoint which gets the template or creates it if it doesn't exist. The function to get or create the hidden template already existed but has been moved to the template DAO now that it is used in more places.
This commit is contained in:
@@ -25,7 +25,9 @@ from app.dao.templates_dao import (
|
||||
dao_get_all_templates_for_service,
|
||||
dao_get_template_versions,
|
||||
dao_update_template_reply_to,
|
||||
dao_get_template_by_id)
|
||||
dao_get_template_by_id,
|
||||
get_precompiled_letter_template,
|
||||
)
|
||||
from app.errors import (
|
||||
register_errors,
|
||||
InvalidRequest
|
||||
@@ -138,6 +140,14 @@ def update_template(service_id, template_id):
|
||||
return jsonify(data=template_schema.dump(update_dict).data), 200
|
||||
|
||||
|
||||
@template_blueprint.route('/precompiled', methods=['GET'])
|
||||
def get_precompiled_template_for_service(service_id):
|
||||
template = get_precompiled_letter_template(service_id)
|
||||
template_dict = template_schema.dump(template).data
|
||||
|
||||
return jsonify(template_dict), 200
|
||||
|
||||
|
||||
@template_blueprint.route('', methods=['GET'])
|
||||
def get_all_templates_for_service(service_id):
|
||||
templates = dao_get_all_templates_for_service(service_id=service_id)
|
||||
|
||||
Reference in New Issue
Block a user