From 6d53f88d4c935b8af1ec240d2acdb8cc89a38d09 Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 16:21:00 -0800 Subject: [PATCH 1/6] feat: email notification templates --- backend/lcfs/web/api/email/services.py | 31 ++++-- .../lcfs/web/api/email/template_mapping.py | 34 +++--- ...pliance_report__director_assessment.jinja2 | 5 + ...iative_agreement__director_approval.jinja2 | 5 + .../bceid__transfer__director_decision.jinja2 | 5 + .../bceid__transfer__partner_actions.jinja2 | 5 + .../api/email/templates/emailWrapper.jinja2 | 105 ++++++++++++++++++ ...ompliance_report__director_decision.jinja2 | 5 + ...ance_report__manager_recommendation.jinja2 | 5 + ...liance_report__submitted_for_review.jinja2 | 5 + ...tive_agreement__returned_to_analyst.jinja2 | 5 + ...nalyst__transfer__director_recorded.jinja2 | 5 + ...analyst__transfer__rescinded_action.jinja2 | 5 + ...yst__transfer__submitted_for_review.jinja2 | 5 + ...ance_report__analyst_recommendation.jinja2 | 5 + ...pliance_report__director_assessment.jinja2 | 5 + ...liance_report__submitted_for_review.jinja2 | 5 + ...ance_report__manager_recommendation.jinja2 | 5 + ...e_agreement__analyst_recommendation.jinja2 | 5 + ...r__transfer__analyst_recommendation.jinja2 | 5 + 20 files changed, 227 insertions(+), 28 deletions(-) create mode 100644 backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/emailWrapper.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 create mode 100644 backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 diff --git a/backend/lcfs/web/api/email/services.py b/backend/lcfs/web/api/email/services.py index 856874d92..c69ba55db 100644 --- a/backend/lcfs/web/api/email/services.py +++ b/backend/lcfs/web/api/email/services.py @@ -36,9 +36,12 @@ def __init__(self, repo: CHESEmailRepository = Depends()): self._token_expiry = None self._validate_configuration() - # Initialize template environment + # Update template directory path to the root templates directory template_dir = os.path.join(os.path.dirname(__file__), "templates") - self.template_env = Environment(loader=FileSystemLoader(template_dir)) + self.template_env = Environment( + loader=FileSystemLoader(template_dir), + autoescape=True # Enable autoescaping for security + ) def _validate_configuration(self): """ @@ -63,7 +66,8 @@ async def send_notification_email( notification_type, organization_id ) if not recipient_emails: - logger.info(f"No subscribers for notification type: {notification_type}") + logger.info(f"No subscribers for notification type: { + notification_type}") return False # Render the email content @@ -85,14 +89,19 @@ def _render_email_template( """ Render an email template using a predefined mapping of template names to file paths. """ - # Fetch template file path from the imported mapping - template_file = TEMPLATE_MAPPING.get( - template_name, TEMPLATE_MAPPING["default"] - ) - - # Render the template - template = self.template_env.get_template(template_file) - return template.render(context) + try: + # Get template file path from mapping using the notification type string directly + template_file = TEMPLATE_MAPPING.get( + template_name, TEMPLATE_MAPPING["default"]) + + # Load and render the template + template = self.template_env.get_template(template_file) + return template.render(**context) + except Exception as e: + logger.error(f"Template rendering error: {str(e)}") + template = self.template_env.get_template( + TEMPLATE_MAPPING["default"]) + return template.render(**context) def _build_email_payload( self, recipients: List[str], context: Dict[str, Any], body: str diff --git a/backend/lcfs/web/api/email/template_mapping.py b/backend/lcfs/web/api/email/template_mapping.py index d31291666..48a90c2c5 100644 --- a/backend/lcfs/web/api/email/template_mapping.py +++ b/backend/lcfs/web/api/email/template_mapping.py @@ -1,20 +1,20 @@ TEMPLATE_MAPPING = { - "BCEID__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "bceid__compliance_report__director_assessment.html", - "BCEID__INITIATIVE_AGREEMENT__DIRECTOR_APPROVAL": "bceid__initiative_agreement__director_approval.html", - "BCEID__TRANSFER__DIRECTOR_DECISION": "bceid__transfer__director_decision.html", - "BCEID__TRANSFER__PARTNER_ACTIONS": "bceid__transfer__partner_actions.html", - "IDIR_ANALYST__COMPLIANCE_REPORT__DIRECTOR_DECISION": "idir_analyst__compliance_report__director_decision.html", - "IDIR_ANALYST__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_analyst__compliance_report__manager_recommendation.html", - "IDIR_ANALYST__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_analyst__compliance_report__submitted_for_review.html", - "IDIR_ANALYST__INITIATIVE_AGREEMENT__RETURNED_TO_ANALYST": "idir_analyst__initiative_agreement__returned_to_analyst.html", - "IDIR_ANALYST__TRANSFER__DIRECTOR_RECORDED": "idir_analyst__transfer__director_recorded.html", - "IDIR_ANALYST__TRANSFER__RESCINDED_ACTION": "idir_analyst__transfer__rescinded_action.html", - "IDIR_ANALYST__TRANSFER__SUBMITTED_FOR_REVIEW": "idir_analyst__transfer__submitted_for_review.html", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__ANALYST_RECOMMENDATION": "idir_compliance_manager__compliance_report__analyst_recommendation.html", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "idir_compliance_manager__compliance_report__director_assessment.html", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_compliance_manager__compliance_report__submitted_for_review.html", - "IDIR_DIRECTOR__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_director__compliance_report__manager_recommendation.html", - "IDIR_DIRECTOR__INITIATIVE_AGREEMENT__ANALYST_RECOMMENDATION": "idir_director__initiative_agreement__analyst_recommendation.html", - "IDIR_DIRECTOR__TRANSFER__ANALYST_RECOMMENDATION": "idir_director__transfer__analyst_recommendation.html", + "BCEID__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "bceid__compliance_report__director_assessment.jinja2", + "BCEID__INITIATIVE_AGREEMENT__DIRECTOR_APPROVAL": "bceid__initiative_agreement__director_approval.jinja2", + "BCEID__TRANSFER__DIRECTOR_DECISION": "bceid__transfer__director_decision.jinja2", + "BCEID__TRANSFER__PARTNER_ACTIONS": "bceid__transfer__partner_actions.jinja2", + "IDIR_ANALYST__COMPLIANCE_REPORT__DIRECTOR_DECISION": "idir_analyst__compliance_report__director_decision.jinja2", + "IDIR_ANALYST__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_analyst__compliance_report__manager_recommendation.jinja2", + "IDIR_ANALYST__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_analyst__compliance_report__submitted_for_review.jinja2", + "IDIR_ANALYST__INITIATIVE_AGREEMENT__RETURNED_TO_ANALYST": "idir_analyst__initiative_agreement__returned_to_analyst.jinja2", + "IDIR_ANALYST__TRANSFER__DIRECTOR_RECORDED": "idir_analyst__transfer__director_recorded.jinja2", + "IDIR_ANALYST__TRANSFER__RESCINDED_ACTION": "idir_analyst__transfer__rescinded_action.jinja2", + "IDIR_ANALYST__TRANSFER__SUBMITTED_FOR_REVIEW": "idir_analyst__transfer__submitted_for_review.jinja2", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__ANALYST_RECOMMENDATION": "idir_compliance_manager__compliance_report__analyst_recommendation.jinja2", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "idir_compliance_manager__compliance_report__director_assessment.jinja2", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_compliance_manager__compliance_report__submitted_for_review.jinja2", + "IDIR_DIRECTOR__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_director__compliance_report__manager_recommendation.jinja2", + "IDIR_DIRECTOR__INITIATIVE_AGREEMENT__ANALYST_RECOMMENDATION": "idir_director__initiative_agreement__analyst_recommendation.jinja2", + "IDIR_DIRECTOR__TRANSFER__ANALYST_RECOMMENDATION": "idir_director__transfer__analyst_recommendation.jinja2", "default": "default.html", } diff --git a/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 b/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 b/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 new file mode 100644 index 000000000..4a9e1c6da --- /dev/null +++ b/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreement

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 b/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 new file mode 100644 index 000000000..6706a922f --- /dev/null +++ b/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfers

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 b/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 new file mode 100644 index 000000000..6706a922f --- /dev/null +++ b/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfers

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/emailWrapper.jinja2 b/backend/lcfs/web/api/email/templates/emailWrapper.jinja2 new file mode 100644 index 000000000..3130bd8d4 --- /dev/null +++ b/backend/lcfs/web/api/email/templates/emailWrapper.jinja2 @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + Low Carbon Fuels Standard Reporting System +
+
+

This email was generated by the Government of British Columbia, Low Carbon Fuel Standard + portal.

+ {% block content %}{% endblock %} +

You received this email because you subscribed at the site above, to stop receiving these + email, log in to your account here: https://lowcarbonfuels.gov.bc.ca/notifications +

+
+
+ + + \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 new file mode 100644 index 000000000..31facc973 --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreements

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 new file mode 100644 index 000000000..de65c808e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 new file mode 100644 index 000000000..de65c808e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 new file mode 100644 index 000000000..de65c808e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 new file mode 100644 index 000000000..8043db08e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 new file mode 100644 index 000000000..31facc973 --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreements

+{% endblock %} diff --git a/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 new file mode 100644 index 000000000..de65c808e --- /dev/null +++ b/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 @@ -0,0 +1,5 @@ +{% extends 'emailWrapper.jinja2' %} +{% block content %} +

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

+{% endblock %} From eeaf7c52fe9cb9528707944610a80cd5ea96329f Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 16:23:23 -0800 Subject: [PATCH 2/6] fix: string --- backend/lcfs/web/api/email/services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/lcfs/web/api/email/services.py b/backend/lcfs/web/api/email/services.py index c69ba55db..14db8a132 100644 --- a/backend/lcfs/web/api/email/services.py +++ b/backend/lcfs/web/api/email/services.py @@ -66,8 +66,8 @@ async def send_notification_email( notification_type, organization_id ) if not recipient_emails: - logger.info(f"No subscribers for notification type: { - notification_type}") + logger.info(f"""No subscribers for notification type: { + notification_type}""") return False # Render the email content From 9bd61d0673c9b5cb0a266fd09da4d27d7f411a38 Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 16:29:11 -0800 Subject: [PATCH 3/6] fix: switch to html --- ....jinja2 => bceid__compliance_report__director_assessment.html} | 0 ...jinja2 => bceid__initiative_agreement__director_approval.html} | 0 ...or_decision.jinja2 => bceid__transfer__director_decision.html} | 0 ...rtner_actions.jinja2 => bceid__transfer__partner_actions.html} | 0 .../email/templates/{emailWrapper.jinja2 => emailWrapper.html} | 0 ...a2 => idir_analyst__compliance_report__director_decision.html} | 0 ... idir_analyst__compliance_report__manager_recommendation.html} | 0 ...=> idir_analyst__compliance_report__submitted_for_review.html} | 0 ... idir_analyst__initiative_agreement__returned_to_analyst.html} | 0 ...rded.jinja2 => idir_analyst__transfer__director_recorded.html} | 0 ...ction.jinja2 => idir_analyst__transfer__rescinded_action.html} | 0 ...w.jinja2 => idir_analyst__transfer__submitted_for_review.html} | 0 ...iance_manager__compliance_report__analyst_recommendation.html} | 0 ...mpliance_manager__compliance_report__director_assessment.html} | 0 ...pliance_manager__compliance_report__submitted_for_review.html} | 0 ...idir_director__compliance_report__manager_recommendation.html} | 0 ...r_director__initiative_agreement__analyst_recommendation.html} | 0 ...inja2 => idir_director__transfer__analyst_recommendation.html} | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename backend/lcfs/web/api/email/templates/{bceid__compliance_report__director_assessment.jinja2 => bceid__compliance_report__director_assessment.html} (100%) rename backend/lcfs/web/api/email/templates/{bceid__initiative_agreement__director_approval.jinja2 => bceid__initiative_agreement__director_approval.html} (100%) rename backend/lcfs/web/api/email/templates/{bceid__transfer__director_decision.jinja2 => bceid__transfer__director_decision.html} (100%) rename backend/lcfs/web/api/email/templates/{bceid__transfer__partner_actions.jinja2 => bceid__transfer__partner_actions.html} (100%) rename backend/lcfs/web/api/email/templates/{emailWrapper.jinja2 => emailWrapper.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__compliance_report__director_decision.jinja2 => idir_analyst__compliance_report__director_decision.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__compliance_report__manager_recommendation.jinja2 => idir_analyst__compliance_report__manager_recommendation.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__compliance_report__submitted_for_review.jinja2 => idir_analyst__compliance_report__submitted_for_review.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__initiative_agreement__returned_to_analyst.jinja2 => idir_analyst__initiative_agreement__returned_to_analyst.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__transfer__director_recorded.jinja2 => idir_analyst__transfer__director_recorded.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__transfer__rescinded_action.jinja2 => idir_analyst__transfer__rescinded_action.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_analyst__transfer__submitted_for_review.jinja2 => idir_analyst__transfer__submitted_for_review.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 => idir_compliance_manager__compliance_report__analyst_recommendation.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_compliance_manager__compliance_report__director_assessment.jinja2 => idir_compliance_manager__compliance_report__director_assessment.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_compliance_manager__compliance_report__submitted_for_review.jinja2 => idir_compliance_manager__compliance_report__submitted_for_review.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_director__compliance_report__manager_recommendation.jinja2 => idir_director__compliance_report__manager_recommendation.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_director__initiative_agreement__analyst_recommendation.jinja2 => idir_director__initiative_agreement__analyst_recommendation.html} (100%) rename backend/lcfs/web/api/email/templates/{idir_director__transfer__analyst_recommendation.jinja2 => idir_director__transfer__analyst_recommendation.html} (100%) diff --git a/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 b/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html similarity index 100% rename from backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.jinja2 rename to backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html diff --git a/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 b/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html similarity index 100% rename from backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.jinja2 rename to backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 b/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html similarity index 100% rename from backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.jinja2 rename to backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 b/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html similarity index 100% rename from backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.jinja2 rename to backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html diff --git a/backend/lcfs/web/api/email/templates/emailWrapper.jinja2 b/backend/lcfs/web/api/email/templates/emailWrapper.html similarity index 100% rename from backend/lcfs/web/api/email/templates/emailWrapper.jinja2 rename to backend/lcfs/web/api/email/templates/emailWrapper.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.jinja2 rename to backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.jinja2 rename to backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.jinja2 rename to backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.jinja2 rename to backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html diff --git a/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.jinja2 rename to backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html diff --git a/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.jinja2 rename to backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html diff --git a/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 b/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html similarity index 100% rename from backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.jinja2 rename to backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html From b3b9669fd00acd91b59429dd6a8c626798294cce Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 17:00:32 -0800 Subject: [PATCH 4/6] refactor: simplify templates --- .../bceid__compliance_report__director_assessment.html | 8 +++----- .../bceid__initiative_agreement__director_approval.html | 8 +++----- .../templates/bceid__transfer__director_decision.html | 8 +++----- .../email/templates/bceid__transfer__partner_actions.html | 8 +++----- ...dir_analyst__compliance_report__director_decision.html | 8 +++----- ...nalyst__compliance_report__manager_recommendation.html | 8 +++----- ..._analyst__compliance_report__submitted_for_review.html | 8 +++----- ...nalyst__initiative_agreement__returned_to_analyst.html | 8 +++----- .../idir_analyst__transfer__director_recorded.html | 8 +++----- .../idir_analyst__transfer__rescinded_action.html | 8 +++----- .../idir_analyst__transfer__submitted_for_review.html | 8 +++----- ...anager__compliance_report__analyst_recommendation.html | 8 +++----- ...e_manager__compliance_report__director_assessment.html | 8 +++----- ..._manager__compliance_report__submitted_for_review.html | 8 +++----- ...rector__compliance_report__manager_recommendation.html | 8 +++----- ...tor__initiative_agreement__analyst_recommendation.html | 8 +++----- .../idir_director__transfer__analyst_recommendation.html | 8 +++----- .../{emailWrapper.html => notification_base.html} | 6 +++++- 18 files changed, 56 insertions(+), 86 deletions(-) rename backend/lcfs/web/api/email/templates/{emailWrapper.html => notification_base.html} (98%) diff --git a/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html b/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html +++ b/backend/lcfs/web/api/email/templates/bceid__compliance_report__director_assessment.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html b/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html index 4a9e1c6da..35e2912d7 100644 --- a/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html +++ b/backend/lcfs/web/api/email/templates/bceid__initiative_agreement__director_approval.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreement

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Initiative Agreement' %} +{% set url_slug = 'initiative-agreement' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html b/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html index 6706a922f..18063fc72 100644 --- a/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html +++ b/backend/lcfs/web/api/email/templates/bceid__transfer__director_decision.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfers

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfers' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html b/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html index 6706a922f..18063fc72 100644 --- a/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html +++ b/backend/lcfs/web/api/email/templates/bceid__transfer__partner_actions.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfers

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfers' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__director_decision.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__manager_recommendation.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__compliance_report__submitted_for_review.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html b/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html index 31facc973..43a49a9d1 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__initiative_agreement__returned_to_analyst.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreements

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Initiative Agreement' %} +{% set url_slug = 'initiative-agreements' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html index de65c808e..9ddb47ee8 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__director_recorded.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfer-requests' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html index de65c808e..9ddb47ee8 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__rescinded_action.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfer-requests' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html index de65c808e..9ddb47ee8 100644 --- a/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html +++ b/backend/lcfs/web/api/email/templates/idir_analyst__transfer__submitted_for_review.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfer-requests' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__analyst_recommendation.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__director_assessment.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html +++ b/backend/lcfs/web/api/email/templates/idir_compliance_manager__compliance_report__submitted_for_review.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html b/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html index 8043db08e..56009ef1b 100644 --- a/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html +++ b/backend/lcfs/web/api/email/templates/idir_director__compliance_report__manager_recommendation.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Credit Record update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/credit-records

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Credit Record' %} +{% set url_slug = 'credit-records' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html b/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html index 31facc973..43a49a9d1 100644 --- a/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html +++ b/backend/lcfs/web/api/email/templates/idir_director__initiative_agreement__analyst_recommendation.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

An Initiative Agreement update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/initiative-agreements

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Initiative Agreement' %} +{% set url_slug = 'initiative-agreements' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html b/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html index de65c808e..9ddb47ee8 100644 --- a/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html +++ b/backend/lcfs/web/api/email/templates/idir_director__transfer__analyst_recommendation.html @@ -1,5 +1,3 @@ -{% extends 'emailWrapper.jinja2' %} -{% block content %} -

A Transfer update has occurred within the Low Carbon Fuel Standard portal.

-

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/transfer-requests

-{% endblock %} +{% extends 'notification_base.html' %} +{% set notification_type = 'Transfer' %} +{% set url_slug = 'transfer-requests' %} \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/emailWrapper.html b/backend/lcfs/web/api/email/templates/notification_base.html similarity index 98% rename from backend/lcfs/web/api/email/templates/emailWrapper.html rename to backend/lcfs/web/api/email/templates/notification_base.html index 3130bd8d4..560b93243 100644 --- a/backend/lcfs/web/api/email/templates/emailWrapper.html +++ b/backend/lcfs/web/api/email/templates/notification_base.html @@ -90,7 +90,11 @@

This email was generated by the Government of British Columbia, Low Carbon Fuel Standard portal.

- {% block content %}{% endblock %} +

A {{ notification_type }} update has occurred within the Low Carbon Fuel Standard portal.

+

For more details, please go to: https://lowcarbonfuels.gov.bc.ca/{{ + url_slug }} +

You received this email because you subscribed at the site above, to stop receiving these email, log in to your account here: https://lowcarbonfuels.gov.bc.ca/notifications From fb4fe414e30cbde41663ad4146c798e973cb35a0 Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 17:03:17 -0800 Subject: [PATCH 5/6] fix: remove default and switch to html --- backend/lcfs/web/api/email/services.py | 12 +++---- .../lcfs/web/api/email/template_mapping.py | 35 +++++++++---------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/backend/lcfs/web/api/email/services.py b/backend/lcfs/web/api/email/services.py index 14db8a132..602283e03 100644 --- a/backend/lcfs/web/api/email/services.py +++ b/backend/lcfs/web/api/email/services.py @@ -88,20 +88,16 @@ def _render_email_template( ) -> str: """ Render an email template using a predefined mapping of template names to file paths. + Raises an exception if template is not found. """ try: - # Get template file path from mapping using the notification type string directly - template_file = TEMPLATE_MAPPING.get( - template_name, TEMPLATE_MAPPING["default"]) - - # Load and render the template + template_file = TEMPLATE_MAPPING[template_name] template = self.template_env.get_template(template_file) return template.render(**context) except Exception as e: logger.error(f"Template rendering error: {str(e)}") - template = self.template_env.get_template( - TEMPLATE_MAPPING["default"]) - return template.render(**context) + raise ValueError( + f"Failed to render email template for {template_name}") def _build_email_payload( self, recipients: List[str], context: Dict[str, Any], body: str diff --git a/backend/lcfs/web/api/email/template_mapping.py b/backend/lcfs/web/api/email/template_mapping.py index 48a90c2c5..4aa78e163 100644 --- a/backend/lcfs/web/api/email/template_mapping.py +++ b/backend/lcfs/web/api/email/template_mapping.py @@ -1,20 +1,19 @@ TEMPLATE_MAPPING = { - "BCEID__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "bceid__compliance_report__director_assessment.jinja2", - "BCEID__INITIATIVE_AGREEMENT__DIRECTOR_APPROVAL": "bceid__initiative_agreement__director_approval.jinja2", - "BCEID__TRANSFER__DIRECTOR_DECISION": "bceid__transfer__director_decision.jinja2", - "BCEID__TRANSFER__PARTNER_ACTIONS": "bceid__transfer__partner_actions.jinja2", - "IDIR_ANALYST__COMPLIANCE_REPORT__DIRECTOR_DECISION": "idir_analyst__compliance_report__director_decision.jinja2", - "IDIR_ANALYST__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_analyst__compliance_report__manager_recommendation.jinja2", - "IDIR_ANALYST__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_analyst__compliance_report__submitted_for_review.jinja2", - "IDIR_ANALYST__INITIATIVE_AGREEMENT__RETURNED_TO_ANALYST": "idir_analyst__initiative_agreement__returned_to_analyst.jinja2", - "IDIR_ANALYST__TRANSFER__DIRECTOR_RECORDED": "idir_analyst__transfer__director_recorded.jinja2", - "IDIR_ANALYST__TRANSFER__RESCINDED_ACTION": "idir_analyst__transfer__rescinded_action.jinja2", - "IDIR_ANALYST__TRANSFER__SUBMITTED_FOR_REVIEW": "idir_analyst__transfer__submitted_for_review.jinja2", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__ANALYST_RECOMMENDATION": "idir_compliance_manager__compliance_report__analyst_recommendation.jinja2", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "idir_compliance_manager__compliance_report__director_assessment.jinja2", - "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_compliance_manager__compliance_report__submitted_for_review.jinja2", - "IDIR_DIRECTOR__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_director__compliance_report__manager_recommendation.jinja2", - "IDIR_DIRECTOR__INITIATIVE_AGREEMENT__ANALYST_RECOMMENDATION": "idir_director__initiative_agreement__analyst_recommendation.jinja2", - "IDIR_DIRECTOR__TRANSFER__ANALYST_RECOMMENDATION": "idir_director__transfer__analyst_recommendation.jinja2", - "default": "default.html", + "BCEID__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "bceid__compliance_report__director_assessment.html", + "BCEID__INITIATIVE_AGREEMENT__DIRECTOR_APPROVAL": "bceid__initiative_agreement__director_approval.html", + "BCEID__TRANSFER__DIRECTOR_DECISION": "bceid__transfer__director_decision.html", + "BCEID__TRANSFER__PARTNER_ACTIONS": "bceid__transfer__partner_actions.html", + "IDIR_ANALYST__COMPLIANCE_REPORT__DIRECTOR_DECISION": "idir_analyst__compliance_report__director_decision.html", + "IDIR_ANALYST__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_analyst__compliance_report__manager_recommendation.html", + "IDIR_ANALYST__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_analyst__compliance_report__submitted_for_review.html", + "IDIR_ANALYST__INITIATIVE_AGREEMENT__RETURNED_TO_ANALYST": "idir_analyst__initiative_agreement__returned_to_analyst.html", + "IDIR_ANALYST__TRANSFER__DIRECTOR_RECORDED": "idir_analyst__transfer__director_recorded.html", + "IDIR_ANALYST__TRANSFER__RESCINDED_ACTION": "idir_analyst__transfer__rescinded_action.html", + "IDIR_ANALYST__TRANSFER__SUBMITTED_FOR_REVIEW": "idir_analyst__transfer__submitted_for_review.html", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__ANALYST_RECOMMENDATION": "idir_compliance_manager__compliance_report__analyst_recommendation.html", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT": "idir_compliance_manager__compliance_report__director_assessment.html", + "IDIR_COMPLIANCE_MANAGER__COMPLIANCE_REPORT__SUBMITTED_FOR_REVIEW": "idir_compliance_manager__compliance_report__submitted_for_review.html", + "IDIR_DIRECTOR__COMPLIANCE_REPORT__MANAGER_RECOMMENDATION": "idir_director__compliance_report__manager_recommendation.html", + "IDIR_DIRECTOR__INITIATIVE_AGREEMENT__ANALYST_RECOMMENDATION": "idir_director__initiative_agreement__analyst_recommendation.html", + "IDIR_DIRECTOR__TRANSFER__ANALYST_RECOMMENDATION": "idir_director__transfer__analyst_recommendation.html", } From 4b28121395e0262a64ac1382086fa31ad1061540 Mon Sep 17 00:00:00 2001 From: Kevin Hashimoto Date: Thu, 5 Dec 2024 17:04:30 -0800 Subject: [PATCH 6/6] chore: remove unused files --- backend/lcfs/web/api/email/templates/default.html | 10 ---------- .../web/api/email/templates/initiative_approved.html | 8 -------- 2 files changed, 18 deletions(-) delete mode 100644 backend/lcfs/web/api/email/templates/default.html delete mode 100644 backend/lcfs/web/api/email/templates/initiative_approved.html diff --git a/backend/lcfs/web/api/email/templates/default.html b/backend/lcfs/web/api/email/templates/default.html deleted file mode 100644 index 18e1cd851..000000000 --- a/backend/lcfs/web/api/email/templates/default.html +++ /dev/null @@ -1,10 +0,0 @@ - - -

System Notification

-

A {{ email_type }} has occurred in the Low Carbon Fuel Reporting System.

- -

For more details, please visit: {{ link }}

- -

You received this email because you subscribed to notifications.

- - \ No newline at end of file diff --git a/backend/lcfs/web/api/email/templates/initiative_approved.html b/backend/lcfs/web/api/email/templates/initiative_approved.html deleted file mode 100644 index f2ae933b6..000000000 --- a/backend/lcfs/web/api/email/templates/initiative_approved.html +++ /dev/null @@ -1,8 +0,0 @@ - - -

Initiative agreement approved notification

-

IA ID: {{ initiative_agreement_id }}

-

Compliance units: {{ compliance_units }}

-

Effective date: {{ transaction_effective_date }}

- - \ No newline at end of file