Add endpoint to get billable units/financial year

`/services/ef7a665d-11a4-425a-a180-a67ca00b69d7/billable-units?year=2016`

Pretty much just passes through to the DAO layer. Validates that year
is:

- present (there’s no need for unbounded queries on this endpoint)
- an integer
This commit is contained in:
Chris Hill-Scott
2016-09-30 19:44:13 +01:00
parent 6a5e947220
commit def1d253aa
2 changed files with 34 additions and 0 deletions

View File

@@ -310,3 +310,13 @@ def update_whitelist(service_id):
else:
dao_add_and_commit_whitelisted_contacts(whitelist_objs)
return '', 204
@service_blueprint.route('/<uuid:service_id>/billable-units')
def get_billable_unit_count(service_id):
try:
return jsonify(notifications_dao.get_notification_billable_unit_count_per_month(
service_id, int(request.args.get('year'))
))
except TypeError:
return jsonify(result='error', message='No valid year provided'), 400