Rename operation_id to id.

This commit is contained in:
Alexis Lahouze 2016-01-12 22:54:17 +01:00
parent cb86fc3680
commit 11d1c6d679

View File

@ -91,11 +91,11 @@ class OperationListResource(Resource):
class OperationResource(Resource): class OperationResource(Resource):
@requires_auth @requires_auth
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def get(self, operation_id): def get(self, id):
""" """
Get operation. Get operation.
""" """
operation = db.session.query(Operation).get(operation_id) operation = db.session.query(Operation).get(id)
if not operation: if not operation:
return None, 404 return None, 404
@ -104,13 +104,13 @@ class OperationResource(Resource):
@requires_auth @requires_auth
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def post(self, operation_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 == operation_id) or kwargs.id == id)
operation = db.session.query(Operation).get(operation_id) operation = db.session.query(Operation).get(id)
if not operation: if not operation:
return None, 404 return None, 404
@ -125,8 +125,8 @@ class OperationResource(Resource):
@requires_auth @requires_auth
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def delete(self, operation_id): def delete(self, id):
operation = db.session.query(Operation).get(operation_id) operation = db.session.query(Operation).get(id)
if not operation: if not operation:
return None, 404 return None, 404
@ -137,4 +137,4 @@ class OperationResource(Resource):
api_api.add_resource(OperationListResource, "/operations") api_api.add_resource(OperationListResource, "/operations")
api_api.add_resource(OperationResource, "/operations/<int:operation_id>") api_api.add_resource(OperationResource, "/operations/<int:id>")