- Add UserCardImport model (stores imported card names as JSON) - Create card_import_schemas.py with request/response models - Create card_import.py router with import/get/delete endpoints - Add Alembic migration 004 (user_card_imports table) - Fuzzy matching for card name matching (60% threshold) - Integration with deckbuilding via imported cards - Endpoints: GET /api/v1/card-import/status, POST /, DELETE /, GET /summary
123 lines
5.3 KiB
JSON
123 lines
5.3 KiB
JSON
{
|
|
"project_summary": "MTG Online Backend API with PostgreSQL database. Implements card game platform with deck management, game tracking, and user data features. Uses FastAPI, SQLAlchemy async, and Alembic for database migrations.",
|
|
"roadmap": [
|
|
{
|
|
"phase": 1,
|
|
"status": "completed",
|
|
"description": "Core application setup with FastAPI, database models, and basic endpoints",
|
|
"key_deliverables": ["FastAPI app", "Database models", "Authentication", "Deck management"]
|
|
},
|
|
{
|
|
"phase": 2,
|
|
"status": "completed",
|
|
"description": "User data schema implementation with Alembic migrations",
|
|
"key_deliverables": ["Alembic configuration", "Async migration environment", "Initial migration script", "User data models (16 tables)", "Updated Dockerfile", "Migration test plan"]
|
|
},
|
|
{
|
|
"phase": 3,
|
|
"status": "completed",
|
|
"description": "API endpoints for user data features",
|
|
"key_deliverables": ["User data routers", "Replay endpoints", "Card collection endpoints", "Group management endpoints", "Network endpoints", "Preferences endpoints", "Activity log endpoints"]
|
|
},
|
|
{
|
|
"phase": 4,
|
|
"status": "completed",
|
|
"description": "Per-user deck building with card search, precedents, and suggestions",
|
|
"key_deliverables": [
|
|
"UserDeck model (DRAFT/FINAL status)",
|
|
"UserDeckCard junction table (card_id references mtgonline_cards.id)",
|
|
"DeckPrecedent and DeckPrecedentCard tables (template support)",
|
|
"CardSuggestion table (suggestion storage)",
|
|
"Alembic migration 003 (mtgonline_cards table)",
|
|
"Deck CRUD endpoints (list, create, get, update, delete)",
|
|
"Card management endpoints (add, update, remove, list cards)",
|
|
"Deck finalize endpoint (DRAFT → FINAL transition)",
|
|
"Precedent endpoints (list, create, get, use/clone)",
|
|
"Card search endpoint (POST /decks/search/cards)",
|
|
"Suggestion endpoints (list, add suggestions)",
|
|
"Pydantic schemas for all deckbuilding operations"
|
|
]
|
|
},
|
|
{
|
|
"phase": 5,
|
|
"status": "pending",
|
|
"description": "Card import with fuzzy matching and deck builder service",
|
|
"key_deliverables": [
|
|
"Fuzzy card matching service (python-Levenshtein)",
|
|
"Card import router (file upload/confirm)",
|
|
"Deck builder service (precedents, suggestions)",
|
|
"Integration tests for import and builder features"
|
|
]
|
|
}
|
|
],
|
|
"tech_stack": {
|
|
"languages": ["Python 3.12"],
|
|
"frameworks": ["FastAPI", "SQLAlchemy (async)", "Alembic"],
|
|
"database": ["PostgreSQL"],
|
|
"dependencies": [
|
|
"fastapi==0.115.0",
|
|
"uvicorn[standard]==0.30.0",
|
|
"sqlalchemy[asyncio]==2.0.34",
|
|
"asyncpg==0.29.0",
|
|
"alembic==1.13.2",
|
|
"python-jose[cryptography]==3.3.0",
|
|
"passlib[bcrypt]==1.7.4",
|
|
"bcrypt==4.0.1",
|
|
"pydantic==2.9.2",
|
|
"pydantic-settings==2.5.2",
|
|
"redis[hiredis]==5.1.0"
|
|
]
|
|
},
|
|
"architectural_notes": "Dual database setup: mtgonline for app data, mtgdata for MTGJSON card data. Alembic migrations run on container startup. Async SQLAlchemy with asyncpg driver. Card mirrors in mtgo_platform for fast deckbuilding queries. User data API mounted at /api/v1/user-data.",
|
|
"task_description": "Update HANDOFF.md and ROADMAP.md to reflect user data schema work and consolidate state.json",
|
|
"current_step": "Phase 4 completed - Per-user deck building with card search, precedents, and suggestions fully implemented",
|
|
"files_created": [
|
|
"alembic.ini",
|
|
"alembic/env.py",
|
|
"alembic/versions/001_initial_user_schema.py",
|
|
"alembic/versions/002_user_deck_building_tables.py",
|
|
"alembic/versions/003_mtgonline_cards_table.py",
|
|
"alembic/versions/__init__.py",
|
|
"app/models/user_data.py",
|
|
"app/models/user_deck.py",
|
|
"app/models/models.py (MtgonlineCard added)",
|
|
"app/schemas/user_data_schemas.py",
|
|
"app/schemas/user_deck_schemas.py",
|
|
"app/routers/user_data.py",
|
|
"app/routers/decks.py",
|
|
"scripts/run_migrations.sh",
|
|
"TEST_PLAN.md",
|
|
"API_DOCUMENTATION.md"
|
|
],
|
|
"files_modified": [
|
|
"app/models/__init__.py",
|
|
"Dockerfile",
|
|
"app/main.py"
|
|
],
|
|
"decisions": [
|
|
"Using Alembic for version-controlled database migrations",
|
|
"Async Alembic configuration with run_sync for database operations",
|
|
"JSONB columns for flexible data storage (replay_data, activity_data)",
|
|
"CASCADE deletes for data integrity in related tables",
|
|
"Composite unique constraints for card collection uniqueness",
|
|
"RESTful API design with pagination support",
|
|
"JWT authentication for all endpoints",
|
|
"Permission checks for group/network management",
|
|
"Option B for cross-DB FK: Local card mirror in mtgonline DB (mtgonline_cards)",
|
|
"Fuzzy matching reserved for card import feature only (handles typos in user input)",
|
|
"Local card search endpoint for fast deckbuilding queries"
|
|
],
|
|
"next_steps": [
|
|
"Test migration execution in container",
|
|
"Run API tests against all endpoints",
|
|
"Add rate limiting for production",
|
|
"Create integration tests",
|
|
"Deploy to staging environment",
|
|
"Phase 5: Card import with fuzzy matching (python-Levenshtein)",
|
|
"Phase 5: Deck builder service for precedents and suggestions"
|
|
],
|
|
"blockers": [],
|
|
"commit_hash": "c23f88c",
|
|
"timestamp": "2026-07-24T04:12:00-04:00"
|
|
}
|