Email: Welcome to first practice — all teams, parent-player meeting Tuesday Apr 7 #312

Closed
opened 2026-04-03 23:22:40 +00:00 by forgejo_admin · 3 comments

Type

Feature

Lineage

Standalone — season starts Apr 7, all 51 parents need welcome email with schedule and parent-player meeting info.

Repo

forgejo_admin/basketball-api

User Story

As an admin,
I want to email all parents welcoming them to the season
So that every family knows about the parent-player meeting and their team's practice schedule.

Context

Season starts Tuesday Apr 7 at West High. Parent-player meeting first 10-15 minutes, then practice. 51 unique parents across 7 teams. Email should include the full weekly schedule for their team (queried from practice_schedules table) and the parent-player meeting details.

Email templates in this codebase are MJML-compiled HTML loaded at runtime from /data/email-templates/ via load_email_template() (defined at email.py:1107). New templates follow this pipeline: write MJML → compile to HTML → mount into container at /data/email-templates/.

Environment

File Targets

Files to create/modify:

  • src/basketball_api/services/email.py — add send_welcome_practice_email() function using load_email_template() or inline HTML following existing patterns
  • src/basketball_api/routes/admin.py — add POST /admin/email/welcome-practice endpoint with optional team/division filter and test_email param
  • Email template file (if using MJML pipeline: add to email-templates build, if inline: include in email.py function)

Files NOT to touch:

  • src/basketball_api/models.py
  • src/basketball_api/routes/schedule.py

Acceptance Criteria

  • Email includes: parent-player meeting (Tue Apr 7, West High, 6-8 PM, first 10-15 min), team-specific practice schedule from DB
  • Personalized per parent: shows their player's team schedule
  • Supports filter by team_id or division, and test_email param
  • Excludes test players (name contains "TEST")
  • Logs to email_log table

Test Expectations

  • Test email to draneylucas@gmail.com renders correctly with sample team data
  • pytest tests/ -k email passes
  • Run command: pytest tests/

Constraints

  • Follow existing email patterns (see send_jersey_reminder_email for reference)
  • Use gmail-sdk via get_gmail_client(tenant, db)
  • Use load_email_template() from email.py:1107 for template loading, OR inline HTML if simpler
  • Query practice_schedules table to build per-team schedule dynamically
  • Must support test_email param for approval gate

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • westside-basketball — project this affects
  • basketball-api#279 — practice schedule data seeding
### Type Feature ### Lineage Standalone — season starts Apr 7, all 51 parents need welcome email with schedule and parent-player meeting info. ### Repo `forgejo_admin/basketball-api` ### User Story As an admin, I want to email all parents welcoming them to the season So that every family knows about the parent-player meeting and their team's practice schedule. ### Context Season starts Tuesday Apr 7 at West High. Parent-player meeting first 10-15 minutes, then practice. 51 unique parents across 7 teams. Email should include the full weekly schedule for their team (queried from practice_schedules table) and the parent-player meeting details. Email templates in this codebase are MJML-compiled HTML loaded at runtime from `/data/email-templates/` via `load_email_template()` (defined at `email.py:1107`). New templates follow this pipeline: write MJML → compile to HTML → mount into container at `/data/email-templates/`. ### Environment - Cluster/namespace: prod / basketball-api - Service: basketball-api email service (gmail-sdk, westsidebasketball@gmail.com) ### File Targets Files to create/modify: - `src/basketball_api/services/email.py` — add `send_welcome_practice_email()` function using `load_email_template()` or inline HTML following existing patterns - `src/basketball_api/routes/admin.py` — add `POST /admin/email/welcome-practice` endpoint with optional team/division filter and test_email param - Email template file (if using MJML pipeline: add to email-templates build, if inline: include in email.py function) Files NOT to touch: - `src/basketball_api/models.py` - `src/basketball_api/routes/schedule.py` ### Acceptance Criteria - [ ] Email includes: parent-player meeting (Tue Apr 7, West High, 6-8 PM, first 10-15 min), team-specific practice schedule from DB - [ ] Personalized per parent: shows their player's team schedule - [ ] Supports filter by team_id or division, and test_email param - [ ] Excludes test players (name contains "TEST") - [ ] Logs to email_log table ### Test Expectations - [ ] Test email to draneylucas@gmail.com renders correctly with sample team data - [ ] `pytest tests/ -k email` passes - Run command: `pytest tests/` ### Constraints - Follow existing email patterns (see `send_jersey_reminder_email` for reference) - Use gmail-sdk via `get_gmail_client(tenant, db)` - Use `load_email_template()` from email.py:1107 for template loading, OR inline HTML if simpler - Query practice_schedules table to build per-team schedule dynamically - Must support test_email param for approval gate ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `westside-basketball` — project this affects - `basketball-api#279` — practice schedule data seeding
Author
Owner

Scope Review: NEEDS_REFINEMENT

Review note: review-763-2026-04-03
One file target is incorrect and an architecture note is missing.

  • [BODY] src/basketball_api/templates/ does not exist. Email templates are MJML-compiled HTML loaded from /data/email-templates/ at runtime via load_email_template(). Fix the file target to reference the email build pipeline (Dockerfile) instead.
  • [SCOPE] Architecture note arch-basketball-api does not exist in pal-e-docs. Cross-cutting gap affecting all basketball-api tickets.
## Scope Review: NEEDS_REFINEMENT Review note: `review-763-2026-04-03` One file target is incorrect and an architecture note is missing. - **[BODY]** `src/basketball_api/templates/` does not exist. Email templates are MJML-compiled HTML loaded from `/data/email-templates/` at runtime via `load_email_template()`. Fix the file target to reference the email build pipeline (Dockerfile) instead. - **[SCOPE]** Architecture note `arch-basketball-api` does not exist in pal-e-docs. Cross-cutting gap affecting all basketball-api tickets.
Author
Owner

Scope refinement (review-763-2026-04-03):

  1. Template path fixed — removed reference to nonexistent src/basketball_api/templates/. Corrected to document the actual pipeline: MJML-compiled HTML loaded via load_email_template() at email.py:1107, mounted at /data/email-templates/. File Targets and Constraints updated.
**Scope refinement (review-763-2026-04-03):** 1. **Template path fixed** — removed reference to nonexistent `src/basketball_api/templates/`. Corrected to document the actual pipeline: MJML-compiled HTML loaded via `load_email_template()` at `email.py:1107`, mounted at `/data/email-templates/`. File Targets and Constraints updated.
Author
Owner

Scope Review: APPROVED

Review note: review-763-2026-04-03-v2
Re-review after refinement. Both previous issues resolved: template path corrected to document load_email_template() pipeline, arch note gap acknowledged as non-blocking backlog item. All file targets verified, traceability complete, 5 testable AC, single-repo scope. Ready for execution.

## Scope Review: APPROVED Review note: `review-763-2026-04-03-v2` Re-review after refinement. Both previous issues resolved: template path corrected to document `load_email_template()` pipeline, arch note gap acknowledged as non-blocking backlog item. All file targets verified, traceability complete, 5 testable AC, single-repo scope. Ready for execution.
forgejo_admin 2026-04-03 23:49:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/basketball-api#312
No description provided.