Rename parameter account to account_id.

This commit is contained in:
Alexis Lahouze 2016-01-13 18:33:21 +01:00
parent e4c0752a2c
commit f961eba9bf
4 changed files with 6 additions and 8 deletions

View File

@ -60,7 +60,7 @@ parser.add_argument('canceled', type=bool)
range_parser = reqparse.RequestParser() range_parser = reqparse.RequestParser()
range_parser.add_argument('account', type=int) range_parser.add_argument('account_id', type=int)
range_parser.add_argument('begin', type=lambda a: dateutil.parser.parse(a)) range_parser.add_argument('begin', type=lambda a: dateutil.parser.parse(a))
range_parser.add_argument('end', type=lambda a: dateutil.parser.parse(a)) range_parser.add_argument('end', type=lambda a: dateutil.parser.parse(a))
@ -75,7 +75,7 @@ class OperationListResource(Resource):
begin=data['begin'], begin=data['begin'],
end=data['end'], end=data['end'],
).filter( ).filter(
Operation.account_id == data['account'] Operation.account_id == data['account_id']
).all(), 200 ).all(), 200
@requires_auth @requires_auth

View File

@ -59,7 +59,7 @@ parser.add_argument('account_id', type=int)
get_parser = reqparse.RequestParser() get_parser = reqparse.RequestParser()
get_parser.add_argument('account', type=int) get_parser.add_argument('account_id', type=int)
class ScheduledOperationListResource(Resource): class ScheduledOperationListResource(Resource):
@ -71,9 +71,7 @@ class ScheduledOperationListResource(Resource):
""" """
data = get_parser.parse_args() data = get_parser.parse_args()
return ScheduledOperation.query().filter( return ScheduledOperation.query().filter_by(**data).all(), 200
ScheduledOperation.account_id == data.account
).all(), 200
@requires_auth @requires_auth
@marshal_with_field(Object(scheduled_operation_model)) @marshal_with_field(Object(scheduled_operation_model))

View File

@ -354,7 +354,7 @@ accountantApp
*/ */
$scope.load = function(begin, end) { $scope.load = function(begin, end) {
$scope.operations = Operation.query({ $scope.operations = Operation.query({
account: $routeParams.accountId, account_id: $routeParams.accountId,
begin: begin.format('YYYY-MM-DD'), begin: begin.format('YYYY-MM-DD'),
end: end.format('YYYY-MM-DD') end: end.format('YYYY-MM-DD')
}); });

View File

@ -48,7 +48,7 @@ accountantApp
*/ */
$scope.load = function() { $scope.load = function() {
$scope.operations = ScheduledOperation.query({ $scope.operations = ScheduledOperation.query({
account: $routeParams.accountId account_id: $routeParams.accountId
}); });
}; };