From c12efa1a29c5621e13366a0ec462533f3ed8fa16 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Thu, 8 Aug 2024 03:56:25 +0000 Subject: [PATCH] chore(models): add help_text for EnrollmentFlow fields --- ...name_eligibilityverifier_enrollmentflow.py | 128 +++++++++++++++++- benefits/core/models.py | 85 +++++++++--- 2 files changed, 193 insertions(+), 20 deletions(-) diff --git a/benefits/core/migrations/0020_rename_eligibilityverifier_enrollmentflow.py b/benefits/core/migrations/0020_rename_eligibilityverifier_enrollmentflow.py index ec484201d7..430381d121 100644 --- a/benefits/core/migrations/0020_rename_eligibilityverifier_enrollmentflow.py +++ b/benefits/core/migrations/0020_rename_eligibilityverifier_enrollmentflow.py @@ -1,6 +1,9 @@ # Generated by Django 5.0.7 on 2024-08-07 21:22 -from django.db import migrations +import benefits.core.models +import benefits.secrets +import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): @@ -23,4 +26,127 @@ class Migration(migrations.Migration): model_name="enrollmentflow", name="active", ), + migrations.AlterField( + model_name="enrollmentflow", + name="claims_provider", + field=models.ForeignKey( + blank=True, + help_text="An entity that provides claims for eligibility verification for this flow.", + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="core.claimsprovider", + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_auth_header", + field=models.TextField( + blank=True, help_text="The auth header to send in Eligibility API requests for this flow.", null=True + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_auth_key_secret_name", + field=benefits.core.models.SecretNameField( + blank=True, + help_text="The name of a secret containing the value of the auth header to send in Eligibility API requests for this flow.", # noqa: E501 + max_length=127, + null=True, + validators=[benefits.secrets.SecretNameValidator()], + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_jwe_cek_enc", + field=models.TextField( + blank=True, + help_text="The JWE-compatible Content Encryption Key (CEK) key-length and mode to use in Eligibility API requests for this flow.", # noqa: E501 + null=True, + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_jwe_encryption_alg", + field=models.TextField( + blank=True, + help_text="The JWE-compatible encryption algorithm to use in Eligibility API requests for this flow.", + null=True, + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_jws_signing_alg", + field=models.TextField( + blank=True, + help_text="The JWS-compatible signing algorithm to use in Eligibility API requests for this flow.", + null=True, + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_public_key", + field=models.ForeignKey( + blank=True, + help_text="The public key used to encrypt Eligibility API requests and to verify signed Eligibility API responses for this flow.", # noqa: E501 + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="core.pemdata", + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_api_url", + field=models.TextField( + blank=True, help_text="Fully qualified URL for an Eligibility API server used by this flow.", null=True + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_form_class", + field=models.TextField( + blank=True, + help_text="The fully qualified Python path of a form class used by this flow, e.g. benefits.eligibility.forms.FormClass", # noqa: E501 + null=True, + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_start_template", + field=models.TextField( + default="eligibility/start.html", + help_text="Path to a Django template for the informational page of this flow.", + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="eligibility_unverified_template", + field=models.TextField( + default="eligibility/unverified.html", + help_text="Path to a Django template that defines the page when a user fails eligibility verification for this flow.", # noqa: E501 + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="help_template", + field=models.TextField( + blank=True, + help_text="Path to a Django template that defines the help text for this enrollment flow, used in building the dynamic help page for an agency", # noqa: E501 + null=True, + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="name", + field=models.TextField( + help_text="Primary internal system name for this EnrollmentFlow instance, e.g. in analytics and Eligibility API requests." # noqa: E501 + ), + ), + migrations.AlterField( + model_name="enrollmentflow", + name="selection_label_template", + field=models.TextField( + help_text="Path to a Django template that defines the end-user UI for selecting this flow among other options." + ), + ), ] diff --git a/benefits/core/models.py b/benefits/core/models.py index fe90cdf9ba..af0517ccfc 100644 --- a/benefits/core/models.py +++ b/benefits/core/models.py @@ -172,27 +172,74 @@ class EnrollmentFlow(models.Model): """Represents a user journey through the Benefits app for a single eligibility type.""" id = models.AutoField(primary_key=True) - name = models.TextField() + name = models.TextField( + help_text="Primary internal system name for this EnrollmentFlow instance, e.g. in analytics and Eligibility API requests." # noqa: 501 + ) display_order = models.PositiveSmallIntegerField(default=0, blank=False, null=False) - eligibility_api_url = models.TextField(null=True, blank=True) - eligibility_api_auth_header = models.TextField(null=True, blank=True) - eligibility_api_auth_key_secret_name = SecretNameField(null=True, blank=True) + eligibility_api_url = models.TextField( + null=True, blank=True, help_text="Fully qualified URL for an Eligibility API server used by this flow." + ) + eligibility_api_auth_header = models.TextField( + null=True, + blank=True, + help_text="The auth header to send in Eligibility API requests for this flow.", + ) + eligibility_api_auth_key_secret_name = SecretNameField( + null=True, + blank=True, + help_text="The name of a secret containing the value of the auth header to send in Eligibility API requests for this flow.", # noqa: 501 + ) eligibility_type = models.ForeignKey(EligibilityType, on_delete=models.PROTECT) - # public key is used to encrypt Eligibility API requests and to verify signed Eligibility API responses - eligibility_api_public_key = models.ForeignKey(PemData, related_name="+", on_delete=models.PROTECT, null=True, blank=True) - # The JWE-compatible Content Encryption Key (CEK) key-length and mode - eligibility_api_jwe_cek_enc = models.TextField(null=True, blank=True) - # The JWE-compatible encryption algorithm - eligibility_api_jwe_encryption_alg = models.TextField(null=True, blank=True) - # The JWS-compatible signing algorithm - eligibility_api_jws_signing_alg = models.TextField(null=True, blank=True) - claims_provider = models.ForeignKey(ClaimsProvider, on_delete=models.PROTECT, null=True, blank=True) - selection_label_template = models.TextField() - eligibility_start_template = models.TextField(default="eligibility/start.html") - # reference to a form class used by this flow, e.g. benefits.eligibility.forms.FormClass - eligibility_form_class = models.TextField(null=True, blank=True) - eligibility_unverified_template = models.TextField(default="eligibility/unverified.html") - help_template = models.TextField(null=True, blank=True) + eligibility_api_public_key = models.ForeignKey( + PemData, + related_name="+", + on_delete=models.PROTECT, + null=True, + blank=True, + help_text="The public key used to encrypt Eligibility API requests and to verify signed Eligibility API responses for this flow.", # noqa: E501 + ) + eligibility_api_jwe_cek_enc = models.TextField( + null=True, + blank=True, + help_text="The JWE-compatible Content Encryption Key (CEK) key-length and mode to use in Eligibility API requests for this flow.", # noqa: E501 + ) + eligibility_api_jwe_encryption_alg = models.TextField( + null=True, + blank=True, + help_text="The JWE-compatible encryption algorithm to use in Eligibility API requests for this flow.", + ) + eligibility_api_jws_signing_alg = models.TextField( + null=True, + blank=True, + help_text="The JWS-compatible signing algorithm to use in Eligibility API requests for this flow.", + ) + claims_provider = models.ForeignKey( + ClaimsProvider, + on_delete=models.PROTECT, + null=True, + blank=True, + help_text="An entity that provides claims for eligibility verification for this flow.", + ) + selection_label_template = models.TextField( + help_text="Path to a Django template that defines the end-user UI for selecting this flow among other options." + ) + eligibility_start_template = models.TextField( + default="eligibility/start.html", help_text="Path to a Django template for the informational page of this flow." + ) + eligibility_form_class = models.TextField( + null=True, + blank=True, + help_text="The fully qualified Python path of a form class used by this flow, e.g. benefits.eligibility.forms.FormClass", # noqa: E501 + ) + eligibility_unverified_template = models.TextField( + default="eligibility/unverified.html", + help_text="Path to a Django template that defines the page when a user fails eligibility verification for this flow.", + ) + help_template = models.TextField( + null=True, + blank=True, + help_text="Path to a Django template that defines the help text for this enrollment flow, used in building the dynamic help page for an agency", # noqa: E501 + ) class Meta: ordering = ["display_order"]