Adding in a new message data model and the corresponding methods to in the API.

This commit is contained in:
charltonaustin 2016-10-07 15:56:58 -04:00
parent 7d8cc1fc34
commit 1e733ddffb
8 changed files with 60 additions and 4 deletions

View file

@ -820,7 +820,7 @@ class SuperUserServiceKeyApproval(ApiResource):
abort(403)
@resource('/v1/superuser/messages')
@resource('/v1/messages')
@show_if(features.SUPER_USERS)
class Messages(ApiResource):
""" Resource for getting a list of super user messages """
@ -838,6 +838,10 @@ class Messages(ApiResource):
'type': 'object',
'description': 'A single message',
'properties': {
'id':{
'type': 'integer',
'description': 'The message id',
},
'content': {
'type': 'string',
'description': 'The actual message',
@ -852,12 +856,16 @@ class Messages(ApiResource):
@nickname('getMessages')
def get(self):
""" Return a super users messages """
messages = []
messages = model.message.get_messages()
return {
'messages': messages,
}
@require_scope(scopes.SUPERUSER)
@verify_not_prod
@nickname('createMessages')
def post(self):
""" Create a message """
pass
body = request.get_json()
print body
model.message.create(body['messages'])