- Removed 11 duplicate router files (auth.py, users.py, decks.py, card_router.py, interactions.py, user_data.py, rooms.py, games/router.py, refresh.py, card_import.py, ws.py) - Removed duplicate core files (logging_config.py, settings.py) - Removed unused services (card_mirror_service.py, mtgjson_loader.py, mtgjson_uploader.py) - Removed unused schemas (proto_messages.py, protocol_constants.py) - Created run.py startup script for simple execution - Created app/core/config.py for unified configuration management - Created app/core/logging.py for logging configuration - Consolidated routers into 6 focused files (auth_router.py, users_router.py, decks_router.py, cards_router.py, user_data_router.py, games_router.py) - Updated all imports to use consolidated model paths - Added backward compatibility aliases in database.py - Created SIMPLIFICATION_SUMMARY.md documentation Architecture improvements: - Single unified database engine with auto-detection (SQLite/PostgreSQL) - Consolidated models into 2 files (models.py, mtg_models.py) - Clean router structure with one file per domain - Simplified configuration with sensible defaults - SQLite by default for development, PostgreSQL for production Testing: - All imports verified working - App loads successfully - Ready for development and testing
25 lines
817 B
Python
25 lines
817 B
Python
"""
|
|
Cross-model relationships.
|
|
|
|
This module defines relationships that reference models from other
|
|
model files (e.g., DecklistFile.card_links → DeckCardLink). These
|
|
must be defined AFTER all model classes have been imported to avoid
|
|
circular import issues.
|
|
|
|
Import this module LAST in app/models/__init__.py.
|
|
"""
|
|
from sqlalchemy.orm import relationship
|
|
from app.models.models import DecklistFile
|
|
from app.models.mirror_models import DeckCardLink
|
|
|
|
|
|
# Add the back-reference from DecklistFile to DeckCardLink.
|
|
# This was previously defined dynamically at the bottom of mirror_models.py,
|
|
# but that caused circular imports. Now it lives here and is imported last.
|
|
DecklistFile.card_links = relationship(
|
|
"DeckCardLink",
|
|
back_populates="deck",
|
|
cascade="all, delete-orphan",
|
|
order_by="DeckCardLink.id"
|
|
)
|