Add queries to handle returning usage for all services associated to a given organisation.

This commit is contained in:
Rebecca Law
2020-02-17 16:34:17 +00:00
parent 49533d7792
commit 18f272dc2b
4 changed files with 33 additions and 5 deletions

View File

@@ -125,6 +125,13 @@ def get_organisation_services(organisation_id):
return jsonify([s.serialize_for_org_dashboard() for s in sorted_services])
@organisation_blueprint.route('/<uuid:organisation_id>/services-with-usage', methods=['GET'])
def get_organisation_services_usage(organisation_id):
services = dao_get_organisation_services(organisation_id)
sorted_services = sorted(services, key=lambda s: (-s.active, s.name))
return jsonify([s.serialize_for_org_dashboard() for s in sorted_services])
@organisation_blueprint.route('/<uuid:organisation_id>/users/<uuid:user_id>', methods=['POST'])
def add_user_to_organisation(organisation_id, user_id):
new_org_user = dao_add_user_to_organisation(organisation_id, user_id)