mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Add get all templates schema
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from app.models import SMS_TYPE, TEMPLATE_TYPES
|
||||
from app.schema_validation.definitions import uuid, personalisation
|
||||
from app.v2.template_schema import template
|
||||
|
||||
|
||||
get_template_by_id_request = {
|
||||
@@ -67,6 +68,51 @@ post_template_preview_response = {
|
||||
"required": ["id", "type", "version", "body"]
|
||||
}
|
||||
|
||||
get_all_template_request = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "request schema for parameters allowed when getting all templates",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {"enum": TEMPLATE_TYPES},
|
||||
},
|
||||
"required": ["type"],
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
get_all_template_response = {
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "GET response schema when getting all templates",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"self": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"next": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["self"],
|
||||
},
|
||||
"templates": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/template"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["links", "templates"],
|
||||
"definitions": {
|
||||
"template": template
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def create_post_template_preview_response(template, template_object):
|
||||
subject = template_object.subject if template.template_type != SMS_TYPE else None
|
||||
|
||||
Reference in New Issue
Block a user