Rename *_resource_fields to *_model.

This commit is contained in:
Alexis Lahouze 2016-01-13 13:49:28 +01:00
parent 3fd746916c
commit 5864d4700d

View File

@ -61,13 +61,13 @@ def requires_auth(f):
return wrapped return wrapped
token_resource_fields = { token_model = {
'token': fields.String, 'token': fields.String,
'expiration': fields.DateTime(dt_format='iso8601'), 'expiration': fields.DateTime(dt_format='iso8601'),
'token_type': fields.String 'token_type': fields.String
} }
user_resource_fields = { user_model = {
'id': fields.Integer(default=None), 'id': fields.Integer(default=None),
'email': fields.String, 'email': fields.String,
'active': fields.Boolean 'active': fields.Boolean
@ -79,7 +79,7 @@ parser.add_argument('password', type=str, required=True)
class LoginResource(Resource): class LoginResource(Resource):
@marshal_with(token_resource_fields) @marshal_with(token_model)
def post(self): def post(self):
""" """
Login to retrieve authentication token. Login to retrieve authentication token.
@ -105,7 +105,7 @@ class LoginResource(Resource):
}, 200 }, 200
@requires_auth @requires_auth
@marshal_with_field(Object(user_resource_fields)) @marshal_with_field(Object(user_model))
def get(self): def get(self):
return g.user, 200 return g.user, 200