Merge pull request #594 from GSA/notify-api-316

Rework downloadable reports and fix process_type
This commit is contained in:
Carlo Costino
2023-07-03 15:12:34 -04:00
committed by GitHub
6 changed files with 16 additions and 29 deletions

View File

@@ -451,7 +451,6 @@ def add_service_template(service_id, template_type, template_folder_id=None):
form.template_content.data,
service_id,
form.subject.data if hasattr(form, 'subject') else None,
form.process_type.data,
template_folder_id
)
except HTTPError as e:
@@ -525,8 +524,7 @@ def edit_service_template(service_id, template_id):
template['template_type'],
form.template_content.data,
service_id,
subject,
form.process_type.data,
subject
)
except HTTPError as e:
if e.status_code == 400:

View File

@@ -163,7 +163,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
return self.delete(endpoint, data)
@cache.delete('service-{service_id}-templates')
def create_service_template(self, name, type_, content, service_id, subject=None, process_type='normal',
def create_service_template(self, name, type_, content, service_id, subject=None,
parent_folder_id=None):
"""
Create a service template.
@@ -173,7 +173,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
"template_type": type_,
"content": content,
"service": service_id,
"process_type": process_type,
"process_type": 'normal',
}
if subject:
data.update({
@@ -190,7 +190,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
@cache.delete('service-{service_id}-templates')
@cache.delete_by_pattern('service-{service_id}-template-*')
def update_service_template(
self, id_, name, type_, content, service_id, subject=None, process_type=None
self, id_, name, type_, content, service_id, subject=None
):
"""
Update a service template.
@@ -206,10 +206,9 @@ class ServiceAPIClient(NotifyAdminAPIClient):
data.update({
'subject': subject
})
if process_type:
data.update({
'process_type': process_type
})
data.update({
'process_type': 'normal'
})
data = _attach_current_user(data)
endpoint = "/service/{0}/template/{1}".format(service_id, id_)
return self.post(endpoint, data)

View File

@@ -62,7 +62,7 @@ def generate_notifications_csv(**kwargs):
original_column_headers = original_upload.column_headers
fieldnames = ['Row number'] + original_column_headers + ['Template', 'Type', 'Job', 'Status', 'Time']
else:
fieldnames = ['Recipient', 'Reference', 'Template', 'Type', 'Sent by', 'Sent by email', 'Job', 'Status', 'Time']
fieldnames = ['Recipient', 'Template', 'Type', 'Sent by', 'Job', 'Status', 'Time']
yield ','.join(fieldnames) + '\n'
@@ -85,11 +85,9 @@ def generate_notifications_csv(**kwargs):
else:
values = [
notification['recipient'],
notification['client_reference'],
notification['template_name'],
notification['template_type'],
notification['created_by_name'] or '',
notification['created_by_email_address'] or '',
notification['job_name'] or '',
notification['status'],
notification['created_at']