Rename account_id in id.

This commit is contained in:
Alexis Lahouze 2016-01-12 22:51:50 +01:00
parent 7d9b94bc80
commit cb86fc3680

View File

@ -95,7 +95,7 @@ class AccountListResource(Resource):
class AccountResource(Resource):
@requires_auth
@marshal_with_field(Object(resource_fields))
def get(self, account_id):
def get(self, id):
"""
Get account.
"""
@ -105,16 +105,16 @@ class AccountResource(Resource):
return Account.query(
**kwargs
).filter(
Account.id == account_id
Account.id == id
).one()
except NoResultFound:
return None, 404
@requires_auth
@marshal_with_field(Object(resource_fields))
def delete(self, account_id):
def delete(self, id):
# Need to get the object to update it.
account = db.session.query(Account).get(account_id)
account = db.session.query(Account).get(id)
if not account:
return None, 404
@ -125,14 +125,14 @@ class AccountResource(Resource):
@requires_auth
@marshal_with_field(Object(resource_fields))
def post(self, account_id):
def post(self, id):
kwargs = parser.parse_args()
assert (id not in kwargs or kwargs.id is None
or kwargs.id == account_id)
or kwargs.id == id)
# Need to get the object to update it.
account = db.session.query(Account).get(account_id)
account = db.session.query(Account).get(id)
if not account:
return None, 404
@ -145,12 +145,12 @@ class AccountResource(Resource):
# Return account with solds.
return Account.query().filter(
Account.id == account_id
Account.id == id
).one()
api_api.add_resource(AccountListResource, '/accounts')
api_api.add_resource(AccountResource, '/accounts/<int:account_id>')
api_api.add_resource(AccountResource, '/accounts/<int:id>')
range_parser = reqparse.RequestParser()