mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Return template type for jobs
This is so we can display letter jobs in a different way on the admin app (because it doesn’t make sense for them to have failed/delivered counts like it does for email and text message jobs). As elsewhere we use `fields.Method` to avoid serializing the whole template object.
This commit is contained in:
@@ -380,6 +380,11 @@ class JobSchema(BaseSchema):
|
||||
service_name = fields.Nested(
|
||||
ServiceSchema, attribute="service", dump_to="service_name", only=["name"], dump_only=True)
|
||||
|
||||
template_type = fields.Method('get_template_type', dump_only=True)
|
||||
|
||||
def get_template_type(self, job):
|
||||
return job.template.template_type
|
||||
|
||||
@validates('scheduled_for')
|
||||
def validate_scheduled_for(self, value):
|
||||
_validate_datetime_not_in_past(value)
|
||||
|
||||
Reference in New Issue
Block a user