Commit Graph

5 Commits

Author SHA1 Message Date
Cal Corum
3ad79a4860 Fix OAuth absolute URLs and add account linking endpoints
- Add base_url config setting for OAuth callback URLs
- Change OAuth callbacks from relative to absolute URLs
- Add account linking OAuth flow (GET /auth/link/{provider})
- Add unlink endpoint (DELETE /users/me/link/{provider})
- Add AccountLinkingError and service methods for linking
- Add 14 new tests for linking functionality
- Update Phase 2 plan to mark complete (1072 tests passing)
2026-01-27 22:06:22 -06:00
Cal Corum
4ddc9b8c30 Add detailed Phase 2 (Authentication) project plan
Defines 15 tasks covering OAuth login (Google/Discord), JWT session
management, user services, and API endpoints for player authentication
at play.mantimon.com.

Key components:
- JWT utilities with access/refresh token pattern
- Redis-backed refresh token storage for revocation
- Google and Discord OAuth services
- FastAPI auth dependencies (get_current_user, etc.)
- Account linking support (multiple OAuth providers per user)
- Premium subscription tracking

Estimated: 24 hours across 1-2 weeks
2026-01-27 16:25:57 -06:00
Cal Corum
b95453569b Update Phase 1 plan with gap fixes and Phase 2 prerequisites 2026-01-27 15:38:49 -06:00
Cal Corum
c3c0a310a7 Mark Phase 1 Database complete - all 18 tasks done 2026-01-27 15:22:43 -06:00
Cal Corum
50684a1b11 Add database infrastructure with SQLAlchemy models and test suite
Phase 1 Database Implementation (DB-001 through DB-012):

Models:
- User: OAuth support (Google/Discord), premium subscriptions
- Collection: Card ownership with CardSource enum
- Deck: JSONB cards/energy_cards, validation state
- CampaignProgress: One-to-one with User, medals/NPCs as JSONB
- ActiveGame: In-progress games with GameType enum
- GameHistory: Completed games with EndReason enum, replay data

Infrastructure:
- Alembic migrations with sync psycopg2 (avoids async issues)
- Docker Compose for Postgres (5433) and Redis (6380)
- App config with Pydantic settings
- Redis client helper

Test Infrastructure:
- 68 database tests (47 model + 21 relationship)
- Async factory pattern for test data creation
- Sync TRUNCATE cleanup (solves pytest-asyncio event loop mismatch)
- Uses dev containers instead of testcontainers for reliability

Key technical decisions:
- passive_deletes=True for ON DELETE SET NULL relationships
- NullPool for test sessions (no connection reuse)
- expire_on_commit=False with manual expire() for relationship tests
2026-01-27 10:17:30 -06:00