Adding in validate son request.

This commit is contained in:
charltonaustin 2016-10-10 14:15:09 -04:00
parent fa10d799b2
commit f179320944

View file

@ -827,14 +827,16 @@ class SuperUserMessages(ApiResource):
""" Resource for getting a list of super user messages """
schemas = {
'messages': {
'id': 'messages',
'GetMessage': {
'id': 'GetMessage',
'type': 'object',
'description': 'Messages that a super user has saved in the past',
'properties': {
'message': {
'type': 'array',
'description': 'A list of messages',
'itemType': {
'type': 'object',
'description': 'A single message',
'properties': {
'id': {
'type': 'integer',
@ -844,13 +846,32 @@ class SuperUserMessages(ApiResource):
'type': 'string',
'description': 'The actual message',
},
},
},
},
},
},
'CreateMessage': {
'id': 'CreateMessage',
'type': 'object',
'description': 'Create a new message',
'properties': {
'message': {
'type': 'object',
'description': 'A single message',
'properties': {
'content': {
'type': 'string',
'description': 'The actual message',
},
},
},
},
}
},
},
},
}
@nickname('getMessages')
@validate_json_request('GetMessage')
def get(self):
""" Return a super users messages """
messages = list(model.message.get_messages())
@ -861,6 +882,7 @@ class SuperUserMessages(ApiResource):
@require_scope(scopes.SUPERUSER)
@verify_not_prod
@nickname('createMessages')
@validate_json_request('CreateMessage')
def post(self):
""" Create a message """
body = request.get_json()