Fix references to TemplateType enum in the schema

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
Carlo Costino
2025-05-02 14:56:46 -04:00
parent 43fb72d79c
commit f8858c944f
2 changed files with 10 additions and 3 deletions

View File

@@ -112,6 +112,10 @@ test: ## Run tests and create coverage report
poetry run coverage report -m --fail-under=93
poetry run coverage html -d .coverage_cache
.PHONY: test-debug
test-debug:
poetry run pytest --pdb -x
.PHONY: py-lock
py-lock: ## Syncs dependencies and updates lock file without performing recursive internal updates
poetry lock --no-update

View File

@@ -375,6 +375,7 @@ class TemplateSchema(BaseTemplateSchema, UUIDsAsStringsMixin):
created_by = field_for(models.Template, "created_by", required=True)
process_type = field_for(models.Template, "process_type")
redact_personalisation = fields.Method("redact")
template_type = auto_field(by_value=True)
created_at = FlexibleDateTime()
updated_at = FlexibleDateTime()
@@ -419,6 +420,7 @@ class TemplateHistorySchema(BaseSchema):
reply_to = fields.Method("get_reply_to", allow_none=True)
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
process_type = field_for(models.Template, "process_type")
template_type = auto_field(by_value=True)
created_by = fields.Nested(
UserSchema, only=["id", "name", "email_address"], dump_only=True
@@ -464,7 +466,7 @@ class JobSchema(BaseSchema):
processing_started = FlexibleDateTime()
processing_finished = FlexibleDateTime()
job_status = auto_field()
job_status = auto_field(by_value=True)
scheduled_for = FlexibleDateTime()
service_name = fields.Nested(
@@ -482,7 +484,7 @@ class JobSchema(BaseSchema):
return job.template.name
def get_template_type(self, job):
return job.template.template_type
return job.template.template_type.value
@validates("scheduled_for")
def validate_scheduled_for(self, value):
@@ -597,11 +599,12 @@ class NotificationWithPersonalisationSchema(NotificationWithTemplateSchema):
created_at = auto_field()
id = auto_field()
job_row_number = auto_field()
notification_type = auto_field()
notification_type = auto_field(by_value=True)
reference = auto_field()
sent_at = auto_field()
sent_by = auto_field()
status = auto_field()
template_type = auto_field(by_value=True)
template_version = auto_field()
to = auto_field()
updated_at = auto_field()