- Add UserRepository and LinkedAccountRepository protocols to protocols.py - Add UserEntry and LinkedAccountEntry DTOs for service layer decoupling - Implement PostgresUserRepository and PostgresLinkedAccountRepository - Refactor UserService to use constructor-injected repositories - Add get_user_service factory and UserServiceDep to API deps - Update auth.py and users.py endpoints to use UserServiceDep - Rewrite tests to use FastAPI dependency overrides (no monkey patching) This follows the established repository pattern used by DeckService and CollectionService, enabling future offline fork support. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""PostgreSQL repository implementations for Mantimon TCG.
|
|
|
|
This package contains PostgreSQL-specific implementations of the repository
|
|
protocols. These implementations use SQLAlchemy async sessions for database
|
|
access.
|
|
|
|
Usage:
|
|
from app.repositories.postgres import (
|
|
PostgresCollectionRepository,
|
|
PostgresDeckRepository,
|
|
PostgresLinkedAccountRepository,
|
|
PostgresUserRepository,
|
|
)
|
|
|
|
# Create repository with database session
|
|
collection_repo = PostgresCollectionRepository(db_session)
|
|
deck_repo = PostgresDeckRepository(db_session)
|
|
user_repo = PostgresUserRepository(db_session)
|
|
linked_repo = PostgresLinkedAccountRepository(db_session)
|
|
|
|
# Use via service layer
|
|
service = CollectionService(collection_repo)
|
|
"""
|
|
|
|
from app.repositories.postgres.collection import PostgresCollectionRepository
|
|
from app.repositories.postgres.deck import PostgresDeckRepository
|
|
from app.repositories.postgres.linked_account import PostgresLinkedAccountRepository
|
|
from app.repositories.postgres.user import PostgresUserRepository
|
|
|
|
__all__ = [
|
|
"PostgresCollectionRepository",
|
|
"PostgresDeckRepository",
|
|
"PostgresLinkedAccountRepository",
|
|
"PostgresUserRepository",
|
|
]
|