mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 08:45:16 -05:00
Return template name in job response
If you’ve sent a bunch of jobs from the same contact list then a handy way to differentiate between them will be date sent, but also template name (in effect the message you sent). This commit extends the job response to include template name, using the same pattern as for template type.
This commit is contained in:
@@ -380,9 +380,13 @@ class JobSchema(BaseSchema):
|
||||
service_name = fields.Nested(
|
||||
ServiceSchema, attribute="service", dump_to="service_name", only=["name"], dump_only=True)
|
||||
|
||||
template_name = fields.Method('get_template_name', dump_only=True)
|
||||
template_type = fields.Method('get_template_type', dump_only=True)
|
||||
contact_list_id = field_for(models.Job, 'contact_list_id')
|
||||
|
||||
def get_template_name(self, job):
|
||||
return job.template.name
|
||||
|
||||
def get_template_type(self, job):
|
||||
return job.template.template_type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user