Phase 4e+4f: QA nit fixes + email log table #48
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#48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Lineage
plan-2026-03-08-tryout-prep→ Phase 4 → Phase 4e + 4fRepo
forgejo_admin/basketball-apiUser Story
As an admin, I want every email we send tracked in the database so I can see who received what and when — a basic CRM log.
As a developer, I want the QA nits from PR #47 addressed so the codebase stays clean.
Context
PR #47 implements Phase 4a-4d (roster, check-in, walk-ups). QA approved with 5 nits. This issue addresses the actionable nits and adds an
email_logtable for CRM tracking.QA nits from PR #47 review:
register.pyhas a hardcodedSTRIPE_TRYOUT_LINKconstant, whileconfig.pynow hasstripe_tryout_linksetting. Should use the config setting everywhere. Remove the constant fromregister.pyand import from config.checked_in=False). Mistakes happen at the door.Email log table: Currently we only have a
confirmation_email_sentboolean on Registration. No history, no timestamps, no email type tracking. Need an append-only log.File Targets
Files to create:
alembic/versions/XXX_add_email_log_table.py— new migrationFiles to modify:
src/basketball_api/models.py— addEmailLogmodel andEmailTypeenumsrc/basketball_api/services/email.py— updatesend_confirmation_emailto write a row toemail_logafter successful send. Accept optionaldb: Sessionparameter. Log: parent_id, player_id, email_type, recipient_email, gmail_message_id, sent_at, tenant_id.src/basketball_api/routes/register.py— removeSTRIPE_TRYOUT_LINKconstant, importsettings.stripe_tryout_linkfrom config insteadsrc/basketball_api/routes/tryouts.py— add un-check-in POST endpoint, fix admin query to filter by Registration jointests/test_tryouts.py— add test for un-check-in endpoint, test for admin query filteringFiles NOT to touch:
src/basketball_api/routes/coach.py— no changes neededAcceptance Criteria
Nit fixes:
STRIPE_TRYOUT_LINKconstant removed fromregister.py. All references usesettings.stripe_tryout_linkfrom config.POST /tryouts/admin/{tenant_slug}/uncheckin/{player_id}setschecked_in=False. Auth-gated admin. Returns redirect to admin page./tryouts/admin/{slug}) only shows players who have a Registration record (JOIN, not just all Players).Email log:
EmailTypeenum with values:registration,reminder(extensible later)EmailLogmodel: id, tenant_id (FK), parent_id (FK), player_id (FK), email_type (EmailType enum), recipient_email (String), gmail_message_id (String, nullable), sent_at (DateTime, server_default now)email_logtablesend_confirmation_emailaccepts optionaldb: Sessionandemail_type: EmailTypeparameters. When db is provided, writes a row to email_log after successful Gmail send. Default email_type isregistration.Test Expectations
pytest tests/ -vConstraints
worktree-agent-a00d22f6) so it's one merge. If that's not practical, a new branch targeting main is fine — PR #47 can merge first.confirmation_email_sentboolean on Registration for now — don't remove it. The email_log table supplements it; migration to remove can happen post-tryout.models.pyfor the new model.Checklist
Related
project-westside-basketball