Add explicit return codes.
This commit is contained in:
parent
a1d34c5f4e
commit
2e194fe550
@ -100,7 +100,7 @@ class AccountResource(Resource):
|
||||
**kwargs
|
||||
).filter(
|
||||
Account.id == id
|
||||
).one()
|
||||
).one(), 200
|
||||
except NoResultFound:
|
||||
return None, 404
|
||||
|
||||
@ -127,7 +127,7 @@ class AccountResource(Resource):
|
||||
# Return account with solds.
|
||||
return Account.query().filter(
|
||||
Account.id == id
|
||||
).one()
|
||||
).one(), 200
|
||||
|
||||
@requires_auth
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
@ -166,7 +166,7 @@ class CategoriesResource(Resource):
|
||||
def get(self):
|
||||
kwargs = range_parser.parse_args()
|
||||
|
||||
return Operation.get_categories_for_range(**kwargs).all()
|
||||
return Operation.get_categories_for_range(**kwargs).all(), 200
|
||||
|
||||
|
||||
ohlc_resource_fields = {
|
||||
@ -184,7 +184,7 @@ class SoldsResource(Resource):
|
||||
def get(self):
|
||||
kwargs = range_parser.parse_args()
|
||||
|
||||
return Operation.get_ohlc_per_day_for_range(**kwargs).all()
|
||||
return Operation.get_ohlc_per_day_for_range(**kwargs).all(), 200
|
||||
|
||||
|
||||
api_api.add_resource(CategoriesResource, "/categories")
|
||||
|
@ -74,7 +74,7 @@ class OperationListResource(Resource):
|
||||
end=kwargs['end'],
|
||||
).filter(
|
||||
Operation.account_id == kwargs['account']
|
||||
).all()
|
||||
).all(), 200
|
||||
|
||||
@requires_auth
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
@ -85,7 +85,7 @@ class OperationListResource(Resource):
|
||||
|
||||
db.session.add(operation)
|
||||
|
||||
return operation
|
||||
return operation, 201
|
||||
|
||||
|
||||
class OperationResource(Resource):
|
||||
@ -100,7 +100,7 @@ class OperationResource(Resource):
|
||||
if not operation:
|
||||
return None, 404
|
||||
|
||||
return operation
|
||||
return operation, 200
|
||||
|
||||
@requires_auth
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
@ -121,7 +121,7 @@ class OperationResource(Resource):
|
||||
|
||||
db.session.merge(operation)
|
||||
|
||||
return operation
|
||||
return operation, 200
|
||||
|
||||
@requires_auth
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
@ -133,7 +133,7 @@ class OperationResource(Resource):
|
||||
|
||||
db.session.delete(operation)
|
||||
|
||||
return operation
|
||||
return None, 204
|
||||
|
||||
|
||||
api_api.add_resource(OperationListResource, "/operations")
|
||||
|
@ -69,7 +69,7 @@ class ScheduledOperationListResource(Resource):
|
||||
|
||||
return ScheduledOperation.query().filter(
|
||||
ScheduledOperation.account_id == kwargs.account
|
||||
).all()
|
||||
).all(), 200
|
||||
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
def post(self):
|
||||
@ -98,7 +98,7 @@ class ScheduledOperationResource(Resource):
|
||||
try:
|
||||
return ScheduledOperation.query().filter(
|
||||
ScheduledOperation.id == id
|
||||
).one()
|
||||
).one(), 200
|
||||
except NoResultFound:
|
||||
return None, 404
|
||||
|
||||
@ -129,7 +129,7 @@ class ScheduledOperationResource(Resource):
|
||||
|
||||
db.session.flush()
|
||||
|
||||
return scheduled_operation
|
||||
return scheduled_operation, 200
|
||||
|
||||
@marshal_with_field(Object(resource_fields))
|
||||
def delete(self, id):
|
||||
|
Loading…
Reference in New Issue
Block a user