mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Munge stuff into a consistent event data type
We store our audit history in two ways: 1. A list of versions of a service 2. A list of events to do with API keys In the future there could be auditing data which we want to display that is stored in other formats (for example the event table). This commit adds some objects which wrap around the different types of auditing data, and expose a consistent interface to them. This architecture will let us: - write clean code in the presentation layer to display these events on a page - add more types of events in the future by subclassing the `Event` data type, without having to rewrite anything in the presentation layer
This commit is contained in:
@@ -311,7 +311,13 @@ class ServiceAPIClient(NotifyAdminAPIClient):
|
||||
|
||||
# Temp access of service history data. Includes service and api key history
|
||||
def get_service_history(self, service_id):
|
||||
return self.get('/service/{0}/history'.format(service_id))
|
||||
return self.get('/service/{0}/history'.format(service_id))['data']
|
||||
|
||||
def get_service_service_history(self, service_id):
|
||||
return self.get_service_history(service_id)['service_history']
|
||||
|
||||
def get_service_api_key_history(self, service_id):
|
||||
return self.get_service_history(service_id)['api_key_history']
|
||||
|
||||
def get_monthly_notification_stats(self, service_id, year):
|
||||
return self.get(url='/service/{}/notifications/monthly?year={}'.format(service_id, year))
|
||||
|
||||
Reference in New Issue
Block a user