Phase 7: End-to-End API Testing - Database setup, migrations, and application fixes

- Switched from psycopg2 to asyncpg for async SQLAlchemy support
- Fixed router registration in main.py - removed duplicate prefixes
- Added user_data export to routers/__init__.py
- Refactored decks router to use DeckManager service layer
- Integrated FuzzyCardMatcher into card_router search endpoints
- Made WishlistCreate.card_id optional for proper schema validation
- Set PostgreSQL password and configured scram-sha-256 auth
- Updated alembic.ini to use local PostgreSQL instead of Docker hostname
- Created generic_schemas.py for reusable schema patterns
- Added test_routers.py and test_schema_validation.py test files
- All 6 Alembic migrations applied successfully (37 tables created)
- Application running on port 8000 with all services connected
This commit is contained in:
2026-08-18 03:35:19 +00:00
parent bea91db64d
commit 1df04aea52
20 changed files with 862 additions and 513 deletions
+4 -5
View File
@@ -1,5 +1,5 @@
"""Pydantic schemas for card search and import features."""
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict
from typing import List, Optional, Dict, Any
from datetime import datetime
@@ -23,8 +23,7 @@ class CardResponse(BaseModel):
identifiers: Optional[Dict[str, Any]] = None
images: Optional[Dict[str, Any]] = None
class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)
class SetResponse(BaseModel):
@@ -35,8 +34,7 @@ class SetResponse(BaseModel):
release_date: Optional[datetime] = None
card_count: Optional[int] = None
class Config:
from_attributes = True
model_config = ConfigDict(from_attributes=True)
class CardTypeResponse(BaseModel):
@@ -93,6 +91,7 @@ class CardImportSummary(BaseModel):
import_id: Optional[int] = None
# Generic response models
class MessageResponse(BaseModel):
"""Generic message response."""
message: str