Commit Graph
46 Commits
Author SHA1 Message Date
akadmin 6bb4034098 Fix migration 001 - add base table creation for mtgonline_users, mtgonline_decklist_files, and mtgonline_rooms 2026-08-08 05:23:39 +00:00
akadmin 1556a6d1aa Add card list reader and card import test scripts 2026-07-26 18:32:05 +00:00
akadmin fc6b87515e docs: update documentation for rules engine integration
- HANDOFF.md: Added rules engine section, updated architecture diagram
- state.json: Updated project summary, files_created, files_modified, commit_hash
- README.md: Added rules engine to features and architecture
- ROADMAP.md: Added MTG Rules Engine Integration section (2.10)
2026-07-25 21:25:53 +00:00
akadmin 165a6f118f Add MTG rules engine source files 2026-07-25 21:12:28 +00:00
akadmin e8634616d3 docs: update handoff document - Phase 2 complete, Phase 3 architecture planning 2026-07-25 20:48:30 +00:00
akadmin 1e7c762452 Complete Phase 2: Card import, deck building, and full API
- Add card import feature with fuzzy matching
- Implement deck CRUD and management endpoints
- Add user data APIs for groups, networks, preferences, activity, replays
- Create comprehensive API documentation (API_DOCUMENTATION.md)
- Add ENDPOINT_AUDIT.md for endpoint verification
- Update documentation (README, ROADMAP, state.json)
- Update architecture blueprint and Cockatrice analysis
- All Phase 2 deliverables complete and documented
2026-07-25 02:56:29 +00:00
akadmin 351c8a9ba9 docs: update README with card import API documentation and complete roadmap 2026-07-24 04:54:02 +00:00
akadmin 867b7a9c37 feat: add card import feature with fuzzy matching
- 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
2026-07-24 04:47:42 +00:00
akadmin c23f88cd41 feat: complete deckbuilding feature with local card mirror
- Add MtgonlineCard model (local card data mirror in mtgonline DB)
- Create user_deck.py models (UserDeck, UserDeckCard, DeckPrecedent, CardSuggestion)
- Create user_deck_schemas.py with Pydantic schemas
- Update decks.py router to use local MtgonlineCard instead of cross-DB MtgCard
- Add migration 002 (user deck building tables)
- Add migration 003 (mtgonline_cards table)
- All card lookups now use local mirror for fast queries
- No cross-DB joins in deckbuilding endpoints
2026-07-24 04:42:22 +00:00
akadmin 356c2121b2 chore: update state.json with latest commit hash 2026-07-23 03:30:16 +00:00
akadmin 6b38ef07ee chore: update state.json with latest commit hash 2026-07-23 03:30:06 +00:00
akadmin c9bb68c6bc docs: update HANDOFF.md and ROADMAP.md with user data schema progress
- Handoff.md: document 16-table user data schema, Alembic migrations,
  and all API endpoints (replays, cards, groups, networks, preferences, activity)
- Handoff.md: consolidate state.json reference to project root
- Roadmap.md: restructure phases to reflect completed work
  Phase 1: Backend Foundation (complete)
  Phase 2: User Data Schema & API (complete) - 16 tables, 7 routers
  Phase 3: Frontend Development (complete)
  Phase 4: Testing & Deployment (pending)
2026-07-23 03:30:00 +00:00
akadmin 01741f3b7b docs: update state.json with commit hash and timestamp 2026-07-23 03:24:19 +00:00
akadmin c42d7ca0e1 feat: implement user data schema and API endpoints
- Add Alembic migration setup with async configuration
- Create 16 user data models (users, decks, cards, replays, etc.)
- Implement comprehensive API endpoints with JWT auth
- Add replay, card collection, group, network, preferences, and activity log routers
- Include API documentation and migration test plan
- Update Dockerfile to run migrations on startup
2026-07-23 03:23:54 +00:00
akadmin 2c74a107bc Phase 2.1: Card mirror system for deckbuilding features
- Created MtgCardMirror and DeckCardLink models in mirror_models.py
- Created card_mirror_service.py with sync_mirrors functionality
- Added sync_mirrors() method to mtgjson_manager.py
- Added mirror_get_db() dependency to database.py
- Added DecklistFile.status column (DRAUGHT/FINAL)
- Updated DeckCreate schema with status field
- Added DeckWithCardsResponse schema with card_count
- Updated deck router to query card mirrors and return card counts
- Added plain text deck content support
2026-07-22 03:35:57 +00:00
akadmin a01e33eb5e Clean up backend folder - remove obsolete scripts and test files
Removed obsolete scripts that were not imported or used:
- card_interaction_rule_engine.py
- card_profile_extractor.py
- create_card_interaction_graph.py
- interaction_determinator.py
- interaction_pipeline.py
- interaction_recommender.py
- interaction_schema.py
- recommendation_engine.py
- migrate_complete.py
- migrate_schema.py
- test_interaction_determinator.py
- check_mtgjson_full.py
- check_mtgjson_status.py
- verify_integration.py
- verify_mtgjson_data.py
- sanity_check_mtgjson.py
- investigate_sets.py
- inspect_db.py
- code_review.md
- monitor/mtg_monitor.py

Removed test artifacts:
- test.db
- test_download.py
- test_system.py
- setup_db.py
- BACKEND_TESTING_SUMMARY.md
- CHAT_PROMPT_TEST.md
- CONTINUATION_PROMPT.md
- PORTED_STATE.md
- SPEC_synergy-mapping-engine.md
- STATE.md
- SUPPORTED_FILE_TYPES.md

Removed sensitive/environment files:
- .env.local
- state.json (backend)

Cleaned up:
- __pycache__ directories
- venv directory

Backend scripts/ directory now contains only essential data loading and maintenance scripts.
2026-07-22 03:00:04 +00:00
akadmin b4a0b1f8be Update HANDOFF.md with roadmap and statement of intent
- Add Vision Statement and Core Objectives from STATEMENT_OF_INTENT.md
- Add Primary Focus section for backend expansion
- Add Database Schema Expansion requirements
- Add API Endpoints to Implement
- Add Frontend Features to Support (from ROADMAP Phase 2)
- Add Integration Requirements (from ROADMAP Phase 3)
- Add Deployment & Production requirements (from ROADMAP Phase 4)
- Expand Key Files to Review to include strategic documents
- Add Timeline table from ROADMAP
- Update status to Phase 1 Complete
2026-07-22 00:07:49 +00:00
akadmin 2872c562ac Finalize state.json after project completion 2026-07-21 03:55:47 +00:00
akadmin 46abfe5fbc Add comprehensive documentation for MTG Online Backend
- Updated root README with current architecture (dual PostgreSQL, Redis, MTGJSON pipeline)
- Created backend/README.md with detailed architecture, database setup, and troubleshooting
- Updated state.json to reflect completed documentation phase
2026-07-21 03:50:44 +00:00
akadmin 6f01e2d1b4 Add docker-compose.yml for multi-container deployment 2026-07-21 03:00:09 +00:00
akadmin 90822d48c4 Fix MTGJSON download functionality
- Add refresh router with admin-only endpoints
- Fix _decompress_file to handle .psql files correctly
- Fix duplicate imports in mtgjson_manager.py
- Mount refresh router in main.py
- Add download_mtgjson.py standalone script
- Add SUPPORTED_FILE_TYPES.md documentation
2026-07-21 02:58:37 +00:00
akadmin 0eacaba28b docs: update README with volume mount instructions and Docker setup 2026-07-20 22:56:14 +00:00
akadmin ea3c1d9691 Refactor MTGJSON manager to use local files only 2026-07-20 22:20:26 +00:00
akadmin 6a9d90c3b5 Update state.json for full deployment review 2026-07-20 21:48:44 +00:00
akadmin 3fae593a22 Fix MTGJSON download: use .json files, remove gzip unpacking
- Changed REQUIRED_FILES to REQUIRED_JSON_FILES and REQUIRED_ZIP_FILES
- AllSetFiles.zip kept as zip (only available compressed on MTGJSON)
- All other files downloaded as .json (no compression)
- Removed gzip import and unpacking logic for .gz files
- Updated EXPECTED_MIN_SIZES to reflect actual .json file sizes
- Removed validation for non-existent files
2026-07-20 13:59:45 +00:00
akadmin 2369c2cc8c Add comprehensive handoff documentation for new thread 2026-07-20 13:23:40 +00:00
akadmin ad2742c1cf Fix MTGJSON download: use .gz URLs and handle pre-uncompressed files 2026-07-20 04:46:15 +00:00
akadmin 65a1f95b7f Save state and update project documentation 2026-07-20 04:39:46 +00:00
akadmin 20fb57258b Increase download timeout to 60 minutes for large MTGJSON files 2026-07-20 04:38:53 +00:00
akadmin d347e0e586 Double all timeout values to prevent download/upsert timeouts 2026-07-20 04:37:31 +00:00
akadmin 6b3fa63501 Fix: Use download_with_sanity_check() and fail container on download failure 2026-07-20 04:06:43 +00:00
akadmin 0643544327 Update state.json for sanity check implementation 2026-07-20 03:56:32 +00:00
akadmin dedc9a35b3 Add MTGJSON data sanity check with file size validation and retry logic 2026-07-20 03:54:34 +00:00
akadmin f722d7ab62 chore: update state.json with deployment information 2026-07-20 03:20:24 +00:00
akadmin 99c7d08bb1 feat: MTGJSON data manager service with download, unpack, and upsert
- Created MTGJSONManager service for complete data lifecycle
- Handles download, unpack (gzip/zip), and PostgreSQL upsert
- ON CONFLICT DO UPDATE preserves existing data
- Startup triggers initial download on first container init
- Health check verifies MTG data exists in database
- Weekly refresh via MTG_REFRESH_INTERVAL_DAYS setting
- Updated docker-compose start_period to 600s for download time
2026-07-20 03:17:23 +00:00
akadmin bb231a5f5d feat: Add MTGJSON data loading and download scripts
- Fix MtgSet model to match database schema (removed created_at, added image column)
- Create load_mtgjson_data.py script to load AllSetFiles, AllPrintings.psql, and other MTGJSON data
- Create download_mtgjson_data.py script to download MTGJSON API data files
- Add SPEC_synergy-mapping-engine.md documentation

API endpoints are now working (200 OK) but database needs data loading via download_mtgjson_data.py
then load_mtgjson_data.py
2026-07-20 02:08:30 +00:00
wall-o db01e29a54 Final project commit: MTGJSON data integration and backend API 2026-07-20 01:09:45 +00:00
wall-o b170dfd577 feat: Add MTGJSON data integration
- Added MTGJSON data downloader (downloads all MTGJSON API v5 files)
- Added MTGJSON data loader (imports data into PostgreSQL)
- Added MTGJSON data uploader (alternative upsert logic)
- Fixed route ordering in card_router.py (/sets before /{card_name})
- Added load_mtgjson_data.py entry point script

MTGJSON data sources:
- AllPrintings.psql.gz (main cards database)
- AllSetFiles.zip (set and card data)
- AllDeckFiles.zip (deck data)
- AllIdentifiers.json.gz (card identifiers)
- CardTypes.json.gz (card types)
- DeckList.json.gz (deck list metadata)
- Keywords.json.gz (card keywords)
- SetList.json.gz (set list metadata)

Note: MTGJSON set.json does NOT contain image URLs. Only cards have image_uris.
Sets have iconSvgUrl (SVG icons) but no raster image URLs.
2026-07-20 00:15:25 +00:00
akadmin baf13ce294 feat: add MTGJSON to PostgreSQL data loader with upsert logic
- Converts MTGJSON v5 AllPrintings.json to PostgreSQL format
- Upserts data to mtgdata database using psycopg2
- Handles sets and cards with proper foreign key relationships
- Batch processing of 100 cards at a time
- Proper transaction management with commit/rollback
- Verified: 14,866 sets and 14,826 cards loaded successfully
2026-07-19 15:14:54 +00:00
akadmin 02ef8e36bc Complete backend verification: fix syntax errors, create __init__.py files, add setup_db.py, update docker-compose for two PostgreSQL containers 2026-07-18 23:02:44 +00:00
akadmin 3a70feaba5 Add system test script and scripts directory
- Added test_system.py for comprehensive backend testing
- Added scripts/ directory with .gitkeep placeholder
- Updates state.json for latest progress tracking
2026-07-18 19:13:30 +00:00
akadmin 963f130e5f Fix route registration: Add card_router to main.py 2026-07-18 18:49:44 +00:00
akadmin 915242b330 feat: MTG database integration with Redis caching
- Added MTG card ORM models (mtg_cards, mtg_sets tables)
- Created card_database service with search, get_by_name, get_by_set
- Added Redis client with caching layer (3600s TTL default)
- Created card router with caching on all endpoints:
  - Search cards (5min cache)
  - Get card by name (10min cache)
  - Get cards by set (15min cache)
  - Get card types/rarities (30min cache)
  - Get sets (1hr cache)
  - Get statistics (1hr cache)
- Updated settings.py:
  - Added JWT_SECRET_KEY field
  - Added DB_CONFIG and REDIS_CONFIG dictionaries
- Updated security.py to use JWT_SECRET_KEY with fallback
- Updated auth.py to use timezone-aware datetimes
- Updated refresh_mtg.py to use settings instead of os.environ
- Updated mtg_monitor.py to use settings for connections
- Added services package with __init__.py

All 20 tests passing.
2026-07-18 18:41:05 +00:00
akadmin 167a352d44 Fix backend test suite - all 20 tests passing
- Updated JWT tokens to include privlevel for authorization
- Fixed test fixtures to properly hash passwords with bcrypt
- Fixed client fixture to share database session with test fixtures
- Reordered deck router routes to prevent conflicts
- Removed relationship fields from FolderResponse schema
- Updated conftest.py with proper async session management
2026-07-18 16:58:39 +00:00
akadmin 312ac27f88 Fix backend bugs: password hash column rename, dynamic import, AuditLog response_model, websocket reference, missing exports, bcrypt version pin 2026-07-18 05:14:37 +00:00
akadmin 86c12376f8 Initial commit of mtgonline project 2026-07-18 04:57:40 +00:00