Tell the API which contact list a job’s come from

So that we can make enhancements to the UI in the future, for example
grouping jobs within their associated contact list.
This commit is contained in:
Chris Hill-Scott
2020-03-16 17:00:34 +00:00
parent 585fdd9076
commit fc58547be3
6 changed files with 60 additions and 5 deletions

View File

@@ -78,12 +78,15 @@ class JobApiClient(NotifyAdminAPIClient):
def has_jobs(self, service_id):
return bool(self.get_jobs(service_id)['data'])
def create_job(self, job_id, service_id, scheduled_for=None):
def create_job(self, job_id, service_id, scheduled_for=None, contact_list_id=None):
data = {"id": job_id}
if scheduled_for:
data.update({'scheduled_for': scheduled_for})
if contact_list_id:
data.update({'contact_list_id': contact_list_id})
data = _attach_current_user(data)
job = self.post(url='/service/{}/job'.format(service_id), data=data)