Rename account_id in id.
This commit is contained in:
parent
7d9b94bc80
commit
cb86fc3680
@ -95,7 +95,7 @@ class AccountListResource(Resource):
|
|||||||
class AccountResource(Resource):
|
class AccountResource(Resource):
|
||||||
@requires_auth
|
@requires_auth
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
def get(self, account_id):
|
def get(self, id):
|
||||||
"""
|
"""
|
||||||
Get account.
|
Get account.
|
||||||
"""
|
"""
|
||||||
@ -105,16 +105,16 @@ class AccountResource(Resource):
|
|||||||
return Account.query(
|
return Account.query(
|
||||||
**kwargs
|
**kwargs
|
||||||
).filter(
|
).filter(
|
||||||
Account.id == account_id
|
Account.id == id
|
||||||
).one()
|
).one()
|
||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
return None, 404
|
return None, 404
|
||||||
|
|
||||||
@requires_auth
|
@requires_auth
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
def delete(self, account_id):
|
def delete(self, id):
|
||||||
# Need to get the object to update it.
|
# 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:
|
if not account:
|
||||||
return None, 404
|
return None, 404
|
||||||
@ -125,14 +125,14 @@ class AccountResource(Resource):
|
|||||||
|
|
||||||
@requires_auth
|
@requires_auth
|
||||||
@marshal_with_field(Object(resource_fields))
|
@marshal_with_field(Object(resource_fields))
|
||||||
def post(self, account_id):
|
def post(self, id):
|
||||||
kwargs = parser.parse_args()
|
kwargs = parser.parse_args()
|
||||||
|
|
||||||
assert (id not in kwargs or kwargs.id is None
|
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.
|
# 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:
|
if not account:
|
||||||
return None, 404
|
return None, 404
|
||||||
@ -145,12 +145,12 @@ class AccountResource(Resource):
|
|||||||
|
|
||||||
# Return account with solds.
|
# Return account with solds.
|
||||||
return Account.query().filter(
|
return Account.query().filter(
|
||||||
Account.id == account_id
|
Account.id == id
|
||||||
).one()
|
).one()
|
||||||
|
|
||||||
|
|
||||||
api_api.add_resource(AccountListResource, '/accounts')
|
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()
|
range_parser = reqparse.RequestParser()
|
||||||
|
Loading…
Reference in New Issue
Block a user