Phase 2a: Admin endpoint for coach invite link generation #23
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#23
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 2 → Phase 2a (coach invite endpoint)Repo
forgejo_admin/basketball-apiUser Story
As Marcus (via Lucas as admin),
I want to create a coach invite link by providing a coach's name and email,
So that I can text/send the link to coaches and they can onboard themselves.
Context
Phase 2 (PR #9) delivered the full coach onboarding flow — contractor agreement form, Stripe Connect Express setup, status page, token TTL. But it never delivered a way to create Coach records and generate invite URLs. The service layer has
generate_invite_token()andgenerate_invite_expiry()ready to go — nothing calls them from a route.Marcus needs to give Lucas a coach's name + email. Lucas hits the admin endpoint, gets back a URL, Marcus passes it to the coach. That's it.
The Coach model already has
invite_token(String(100), unique) andinvite_expires_at(DateTime) columns from migration 003. No new migration needed.File Targets
Files to modify or create:
src/basketball_api/routes/admin.py— may already exist from Phase 3a PR #22 (hasgenerate-tokensendpoint). AddPOST /admin/invite-coachhere.src/basketball_api/main.py— register admin router if not already registeredtests/test_admin.py— tests for the new endpointFiles NOT to touch:
src/basketball_api/routes/coach.py— onboarding flow is complete, don't modifysrc/basketball_api/services/coach_onboarding.py— service functions already exist, just call themalembic/versions/— no migration needed, columns already existAcceptance Criteria
POST /admin/invite-coachaccepts JSON{name, email, role, tenant_id}and returns{coach_id, invite_url, expires_at}require_role("admin")from pal-e-auth{config.base_url}/coach/onboard?token={token}generate_invite_token(), expiry viagenerate_invite_expiry()(7-day TTL)Test Expectations
pytest tests/test_admin.py -k invite_coachConstraints
admin.pyalready exists on main or in PR #22 branch)generate_invite_token()andgenerate_invite_expiry()fromservices/coach_onboarding.pyconfig.base_urlfor building the full invite URLget_db)Checklist
Related
project-westside-basketball— project this affectsadmin.pywithgenerate-tokensendpoint)