mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
make it clear that this is for the public api, and we shouldn't add fields to it without considering impacts also add the broadcast_messages relationship on service and template to the exclude from the marshmallow schemas, so it's not included elsewhere
19 lines
634 B
Python
19 lines
634 B
Python
from flask import jsonify, request
|
|
|
|
from app import authenticated_service
|
|
from app.dao import templates_dao
|
|
from app.schema_validation import validate
|
|
from app.v2.templates import v2_templates_blueprint
|
|
from app.v2.templates.templates_schemas import get_all_template_request
|
|
|
|
|
|
@v2_templates_blueprint.route("", methods=['GET'])
|
|
def get_templates():
|
|
data = validate(request.args.to_dict(), get_all_template_request)
|
|
|
|
templates = templates_dao.dao_get_all_templates_for_service(authenticated_service.id, data.get('type'))
|
|
|
|
return jsonify(
|
|
templates=[template.serialize_for_v2() for template in templates]
|
|
), 200
|