feat: team placement congratulations email endpoint #126

Closed
opened 2026-03-20 05:38:43 +00:00 by forgejo_admin · 1 comment

Type

Feature

Lineage

plan-wkq → Phase 11 → Issue #118 (send team announcement email)

Repo

forgejo_admin/basketball-api

User Story

As an admin
I want to send a congratulations email to all boy players' parents
So that families know their team assignment, coach, and teammates

Context

After boys tryout team placements are finalized, parents need a branded congratulations email. The email infrastructure already exists (Gmail client, _brand_wrapper(), EmailLog). Need a new email function and admin endpoint. For multi-team players, the email should list all assigned teams.

File Targets

Files the agent should modify or create:

  • src/basketball_api/services/email.py — add send_team_announcement_email() function using existing _brand_wrapper()
  • src/basketball_api/routes/admin.py — add POST /admin/email/team-announcement endpoint
  • src/basketball_api/models.py — add team_announcement to EmailType enum if not present

Files the agent should NOT touch:

  • routes/teams.py — no team logic changes
  • Frontend code — admin triggers this via API call

Acceptance Criteria

  • When I POST /admin/email/team-announcement, each parent receives one email per player
  • Email includes: player name, team name(s), coach name, full roster of teammates
  • Multi-team players show all teams and rosters
  • Email uses branded Westside HTML wrapper
  • Each send is logged in email_log table

Test Expectations

  • Unit test: email HTML contains correct team/player/coach data
  • Unit test: multi-team player email lists all teams
  • Integration test: endpoint sends and logs emails
  • Run command: pytest tests/ -v

Constraints

  • Reuse existing _brand_wrapper() and get_gmail_client() patterns from email.py
  • Follow existing endpoint patterns in admin.py (auth-required, admin-only)
  • Depends on many-to-many migration + new players being added first
  • Filter to boys division only for this send

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • Westside Basketball — project
  • Issue #118 — original tracking issue for this work
  • Depends on: many-to-many migration + manual player additions
### Type Feature ### Lineage `plan-wkq` → Phase 11 → Issue #118 (send team announcement email) ### Repo `forgejo_admin/basketball-api` ### User Story As an admin I want to send a congratulations email to all boy players' parents So that families know their team assignment, coach, and teammates ### Context After boys tryout team placements are finalized, parents need a branded congratulations email. The email infrastructure already exists (Gmail client, `_brand_wrapper()`, EmailLog). Need a new email function and admin endpoint. For multi-team players, the email should list all assigned teams. ### File Targets Files the agent should modify or create: - `src/basketball_api/services/email.py` — add `send_team_announcement_email()` function using existing `_brand_wrapper()` - `src/basketball_api/routes/admin.py` — add `POST /admin/email/team-announcement` endpoint - `src/basketball_api/models.py` — add `team_announcement` to `EmailType` enum if not present Files the agent should NOT touch: - `routes/teams.py` — no team logic changes - Frontend code — admin triggers this via API call ### Acceptance Criteria - [ ] When I POST `/admin/email/team-announcement`, each parent receives one email per player - [ ] Email includes: player name, team name(s), coach name, full roster of teammates - [ ] Multi-team players show all teams and rosters - [ ] Email uses branded Westside HTML wrapper - [ ] Each send is logged in `email_log` table ### Test Expectations - [ ] Unit test: email HTML contains correct team/player/coach data - [ ] Unit test: multi-team player email lists all teams - [ ] Integration test: endpoint sends and logs emails - Run command: `pytest tests/ -v` ### Constraints - Reuse existing `_brand_wrapper()` and `get_gmail_client()` patterns from email.py - Follow existing endpoint patterns in admin.py (auth-required, admin-only) - Depends on many-to-many migration + new players being added first - Filter to boys division only for this send ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `Westside Basketball` — project - Issue #118 — original tracking issue for this work - Depends on: many-to-many migration + manual player additions
Author
Owner

Closing — stale. Teams were announced weeks ago. Placement emails were never built and the moment has passed. If needed for future seasons, create a new ticket.

Closing — stale. Teams were announced weeks ago. Placement emails were never built and the moment has passed. If needed for future seasons, create a new ticket.
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#126
No description provided.