feat: add generic send_templated_email() + contract EmailType values #298
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api!298
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "294-generic-send-templated-email"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a single reusable
send_templated_email()function that accepts a template layout name and data dict, so new email types no longer require new Python functions. Also addscontract_offerandcontract_reminderto theEmailTypeenum with a corresponding Alembic migration.Changes
src/basketball_api/models.py-- addedcontract_offerandcontract_remindertoEmailTypeenumsrc/basketball_api/services/email.py-- addedsend_templated_email()(~50 lines),_html_to_plain_text()helper, andimport realembic/versions/031_add_contract_email_type_enum_values.py-- migration to add enum values to PostgreSQLtests/test_templated_email.py-- 16 tests covering success/failure/missing template/plain text/enum valuesTest Plan
pytest tests/ -k "test_templated_email or test_models" -v-- 16 targeted tests passruff formatandruff checkcleanReview Checklist
contract_offerandcontract_remindersend_templated_email()creates EmailLog with correct fieldsRelated Notes
Related
Closes #294
QA Review -- PR #298
Scope Verification
send_templated_email()signature matches issue spec (tenant, layout, data, to, subject, email_type, db, parent_id, player_id)contract_offerandcontract_reminderCode Quality
send_templated_email()uses keyword-only args aftertenant-- good API design preventing positional arg mistakesdbis required (not optional) -- correct for a function that always writes EmailLogsend_jersey_reminder_email,send_interest_notification_html_to_plain_text()handles links, entities, blank lines -- solid plain text fallbackIF NOT EXISTSfor idempotent enum value additionTest Coverage
Findings
No issues found. Clean, well-scoped implementation that follows existing patterns exactly.
VERDICT: APPROVED