mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Return all required org and services info for user
The admin app now needs to know a few extra things about orgs and services in order to list them. At the moment it does this by making multiple API calls. This commit adds extra fields to the existing response. Once the admin app is using this fields we’ll be able to remove: - `reponse['services_without_organisations']` - `reponse['organisations']['services']`
This commit is contained in:
@@ -515,7 +515,11 @@ def get_orgs_and_services(user):
|
||||
}
|
||||
for service in org.services
|
||||
if service.active and service in user.services
|
||||
]
|
||||
],
|
||||
'count_of_live_services': len([
|
||||
service for service in org.services
|
||||
if service.active and not service.restricted
|
||||
]),
|
||||
}
|
||||
for org in user.organisations if org.active
|
||||
],
|
||||
@@ -534,5 +538,14 @@ def get_orgs_and_services(user):
|
||||
service.organisation not in user.organisations
|
||||
)
|
||||
)
|
||||
],
|
||||
'services': [
|
||||
{
|
||||
'id': service.id,
|
||||
'name': service.name,
|
||||
'restricted': service.restricted,
|
||||
'organisation': service.organisation.id if service.organisation else None,
|
||||
}
|
||||
for service in user.services if service.active
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user