Rename balance to income.

This commit is contained in:
Alexis Lahouze 2017-05-25 22:48:19 +02:00
parent d9e28fb5a9
commit d59d3649f5

View File

@ -43,16 +43,16 @@ balances_model = ns.model('Account balances', {
})
# Account balance model.
balance_model = ns.model('Balance', {
income_model = ns.model('Income', {
'expenses': fields.Float(
readonly=True,
description='Total amount of expenses'),
'revenues': fields.Float(
readonly=True,
description='Total amount of revenues'),
'balance': fields.Float(
'income': fields.Float(
readonly=True,
description='Balance'),
description='Income'),
})
# Category with expenses and revenues.
@ -273,14 +273,14 @@ class BalancesResource(Resource):
), 200
@ns.route('/<int:account_id>/balance')
@ns.route('/<int:account_id>/income')
@ns.doc(
security='apikey',
params={
'account_id': 'Id of the account to manage'
},
responses={
200: ('OK', balance_model),
200: ('OK', income_model),
401: 'Unauthorized',
404: 'Account not found'
})
@ -288,10 +288,10 @@ class BalanceResource(Resource):
"""Resource to expose balances."""
@ns.expect(range_parser)
@ns.marshal_with(balance_model)
@ns.marshal_with(income_model)
@jwt_required
def get(self, account_id):
"""Get account balance for a specific date range."""
"""Get account income for a specific date range."""
account = Account.query().get(account_id)