feat: Sponsor model, migration, and CRUD endpoints #324
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#324
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?
Type
Feature
Lineage
Child of basketball-api#316 (sponsor outreach system). Blocked by: nothing. Blocks: #324 (blast endpoint).
Repo
forgejo_admin/basketball-apiUser Story
As an admin,
I want to manage sponsor contacts in the database,
So that I can track businesses through the outreach pipeline.
Context
This ticket creates the Sponsor data model and basic CRUD endpoints. The model represents a local business in the sponsorship outreach pipeline with status tracking (prospect → contacted → responded → negotiating → committed → declined).
This is the foundation ticket — the blast endpoint (#324) depends on this model and these routes existing.
The seed endpoint (
POST /sponsors/seed) consumes the JSON fixture from #323 but can be built independently — it just needs the model schema.File Targets
Files the agent should modify:
src/basketball_api/models.py— add SponsorStatus enum, SponsorCategory enum, Sponsor model, addsponsor_outreachto EmailType enumsrc/basketball_api/app.py— register sponsor routerFiles the agent should create:
src/basketball_api/services/sponsor_service.py— CRUD functions: get_sponsors, create_sponsor, update_sponsor, delete_sponsor, seed_sponsorssrc/basketball_api/routes/sponsors.py— REST endpointsalembic/versions/xxx_add_sponsors.py— migration for sponsors table + EmailType enum updatetests/test_sponsors.py— tests for model CRUD and endpointsFiles the agent should NOT touch:
src/basketball_api/services/email.py— email sending is in the blast ticketsrc/basketball_api/routes/admin.py— sponsors get their own routerAcceptance Criteria
SponsorStatusenum: prospect, contacted, responded, negotiating, committed, declinedSponsorCategoryenum: food, financial, retail, automotive, construction, fitness, dental, grocery, otherSponsormodel with: id, tenant_id (FK), business_name, email, category, status (default: prospect), custom_pitch (nullable), contact_name (nullable), phone (nullable), notes (nullable), last_contacted_at (nullable), created_at, updated_atEmailType.sponsor_outreachadded to enumGET /sponsors— list sponsors, filterable by?category=food&status=prospectPOST /sponsors— create single sponsorPATCH /sponsors/{id}— update sponsor fields (status, notes, custom_pitch, etc.)DELETE /sponsors/{id}— delete sponsorPOST /sponsors/seed— bulk import from JSON array in request body/sponsorsprefix in app.pyTest Expectations
pytest tests/test_sponsors.py -vConstraints
routes/jersey.py,routes/teams.pyfor style)current_tenant)ALTER TYPE ... ADD VALUEChecklist
Related